Hi Brad,
>
>Yes, if I remember correctly, GIF does not support 24-bit color. But, I
should still be able to encode the image and display it correctly if I am
running 24-bit color. Anybody have suggestions?
>
My experience, on NT 4.0 running True Color, is that the Acme encoder
works on 1.2.2 and does not on 1.1.8. After too much digging a while back,
it appeared that in ImageEncoder in method setPixels(), there is a call to
ColorModel.getRGB(), which returns different values depending on the
version. When it gets back to GIFEncoder, a field named index is genned
from scanning the rgbPixels array. Then there is code like this:
// Figure out how many bits to use.
int logColors;
if ( index <= 2 )
logColors = 1;
else if ( index <= 4 )
logColors = 2;
else if ( index <= 16 )
logColors = 4;
else
logColors = 8;
In my trials, if memory serves, under 1.2.2, logColors ends up being 2;
In 1.1.8, ends up being 1. Same behavior running 1.1.8 under Win 98.
I had not tried it at different color depths before. I just reran my
test program.at 65K and 16M colors and it worked. Back to True Color, it
was black and grey. Since it does work under 1.2.2, this appears to be a
JDK problem. However, since we now know that it works at the other
settings, a workaround may be possible whenever time permits. May want to
send mail to the author. Please let us, or me at any rate, know if you get
a solution.
Joe Sam
Joe Sam Shirah
Autumn Software
What you don't know DOES hurt you...and your business
___________________________________________
-----Original Message-----
From: Brad Cantwell <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Sunday, November 07, 1999 12:17 PM
Subject: Re: Images created in servlet are in black and white
>On Sun, 7 Nov 1999 09:22:28 -0500, Danny Rubis <[EMAIL PROTECTED]> wrote:
>
>>Hey!
>>
>>Someone correct me if I am wrong, but GIF only supports 256 colors. You
>>are trying to do true-color which is much more than 256?
>>
>>Danny Rubis
>>
>>Brad Cantwell wrote:
>>
>>> I am using acme's GifEncoder to dynamically create a chart in gif
format. I can get the image to be created, but it is always in black and
white. It seems that it does not work in true color, but when I switch to
16-bit color it seems to work. How do I get this to work in true-color
mode?
>>>
>>> Here is an example of the method that I am using:
>>>
>>> public void doGet(HttpServletRequest request, HttpServletResponse
response)
>>> {
>>> OutputStream out = response.getOutputStream();
>>>
>>> Frame frame = new Frame();
>>> frame.addNotify();
>>>
>>> Image image = frame.createImage( 100, 100 );
>>> Graphics graphics = image.getGraphics();
>>> graphics.setColor( Color.red );
>>> graphics.drawOval(0, 0, 99, 99);
>>>
>>> response.setContentType( "image/gif" );
>>>
>>> GifEncoder encoder = new GifEncoder( image, out );
>>> encoder.encode();
>>> out.flush();
>>> }
>>>
>>>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html