[JAVA2D] Color depth question
I have a strange situation happening. Perhaps someone can help me make head
or tails of it?
I'm loading up a GIF image (i.e., 8-bit/256 color), then creating an offscreen
BufferedImage (initially with TYPE_INT_ARGB, but I've tried others as I'll
explain later). I then proceed to paint a white background onto it, paint the
GIF onto it, paint some black text over it, and trying to write it out again
as a GIF, using a GIF encoder utility. The GIF encoder, however is throwing
an exception re: > 256 colors.
I'm able to avoid this problem by creating an image of TYPE_BYTE_INDEXED, but
the quality of the image suffers as a result (it looks "grainy", for lack of a
I realize that what's happening is that there's a 32-bit image being produced,
and that it's rendering with > 256 colors, and so that's why I'm having this
problem. But I can't understand why it's rendering with > 256 colors. As the
initial image was a GIF, it was only using an 8-bit set of colors, and the
only other colors I'm using are black and white, both of which I believe are
already being used elsewhere in the image. So I can't see how I'd be using
more colors than the original image.
Anyone have any idea what might be happening here and how to work around it?
I'll use the grainy output image if I have to, but I'd prefer not to if I can
(BTW, I do know about PNG, JPEG, etc., but unfortunately I'm stuck with GIF
format for reasons outside of my control.)
This message is for the sole use of the intended recipient. If you received
this message in error please delete it and notify us. If this message was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until they
are confirmed by us. Message transmission is not guaranteed to be secure.
To unsubscribe, send email to email@example.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
firstname.lastname@example.org and include in the body of the message "help".