Hi What I actually want to do, is to save an 24 bit image as a PNG file. If the image contains less than 256 colors (which is almost always does), I will convert it to an 8 bit indexed image using a colormap with the ORIGINAL colors (not standard colormap) before I save it. Otherwise I will save the image as an 24 bit image or compute an "optimal" colormap whatever is most effiecient both in time and space. So I was looking for some code that converts an 24 bit image to an 8 bit image and makeing the colormap on the fly and fails (and halt) when more than 256 colors is encountererd.
Kjell R to 24-bit image to an 8-bit image if the 24-bit image contains less than 256 colors and using a colormap with the ori On Tue, 1 Apr 2003 08:54:57 -0800, Dmitri Trembovetski <[EMAIL PROTECTED]> wrote: > Hi Kjell, > > no need to use ImageOps, just create a 8-bit image and copy your > 24-bit image using drawImage. > It should look something like this: > BufferedImage image8b = > new BufferedImage(image24b.getWidth(), image24b.getHeight(), > BufferedImage.TYPE_BYTE_INDEXED); > Graphics g = image8b.getGraphics(); > g.drawImage(image24b, 0, 0, null); > > That should do it. > > Thank you, > Dmitri > >On Tue, Apr 01, 2003 at 09:12:02AM -0700, Kjell Roeang wrote: > > Hi > > I want to convert a 24 bit RGB BufferedImage to an 8 bit indexed BufferedImage > > (perhaps using some kind of BufferedImageOp) and wondered if someone already some > > (fast) code for this? The RGB image will contain less 256 differrent colors. > > > > Regards > > > > Kjell Roeang > > > > =========================================================================== > > To unsubscribe, send email to [EMAIL PROTECTED] and include in the body > > of the message "signoff JAVA2D-INTEREST". For general help, send email to > > [EMAIL PROTECTED] and include in the body of the message "help". > > ========================================================================== >To unsubscribe, send email to [EMAIL PROTECTED] and include in the body >of the message "signoff JAVA2D-INTEREST". For general help, send email to >[EMAIL PROTECTED] and include in the body of the message "help". =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
