Skip to main content

[JAI] GIF images corrupt?

9 replies [Last post]
Anonymous

Hi,
I previously posted regarding the performance of taking a huge (200meg)
TIFF image, cropping, scaling, and then writing it out as a JPEG.
I asked the forum about possibiliies for speeding things up. Since
most of the time seemed to be spent in the encoding of the JPEG,
someone suggested encoding into a simpler format - e.g. TIFF or GIF.
But when I tried to encode to GIF, my firefox browser prints the
message:
The image "http://localhost:8084/ja/ImageServer?imgType=gif..."
cannot be displayed, because it contains errors.
In IE, I just see the IE "placeholder" icon for the image.

I'm using the following code to do the encoding - I don't see how I
can be doing anything wrong here - especially when it works for the
other image formats (JPEG, PNG, and TIFF) I've tried:

workingImage = JAI.create("stream", stream);
ServletOutputStream out = response.getOutputStream();

...set parameter block for cropping...
workingImage = JAI.create("crop", pb);
...set parameter block for scaling...
workingImage = JAI.create("scale", pb);
javax.imageio.ImageIO.write(workingImage, "gif", out);

Does anyone have any clue why this could be happening? Many thanks for
all suggestions.

Tom

P.S. Environment: JDK 1.4.2, Tomcat 5.5.7, JAI 1.1.2_01, and JIO 1.0_01
running on Windows XP.
P.P.S. Do I need to worry about synchronization between the scaling operation
and the final rendering? In the other thread on performance, I mentioned that
scaling appears to take less than a millisecond when I print out the time
before/after the operation. James Cheng observed that the rendering might
have been defered?? If that's the case, perhaps I need to wait with the
final encoding until scaling is done? How is this done? I'm a JAI novice.

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Thomas Wolf

Hi Mike,

Nidel, Mike wrote:
...
> So you are cropping, scaling, then writing a JPEG from a 200MB
> TIFF file. This brings us to the perennial question: is your
> source image tiled? If not, then as soon as you ask for a single
> pixel, you will probably end up reading the entire image into
> memory. If this is the case, then I would say that reading 200MB
> into main memory in 5 sec is probably not slow at all.

I don't think the source TIFFs are "tiled" - although I haven't got a
clue on how to check that for sure (as you may have been able to tell
from my posts, I'm not that versed in imaging :-) But I expected the
whole image to be read into memory anyway - and I think the "reading
into memory" is a one-time cost incurred with this call:
workingImage = JAI.create("stream", stream);
This method only gets called the first time the front-end requests a
part of the image. After that, I retrieve a reference to this source
image via the session and simply do the cropping and scaling
operations and output as a JPEG.

So, from my perspective, I can understand a 5sec initial delay as a 200mb
image is read in. But subsequent operations should be much faster.
But they aren't. I think I'm missing something important here :-(

After getting James' suggestion regarding timing the operations,
long t0 = System.currentTimeMillis();
workingImage = JAI.create("scale", pb);
workingImage.getTiles(); // force to compute
long t1 = System.currentTimeMillis();
System.out.println("Time spent in scale= "+(t1-t0));
I now see that what I thought was a 5+ second encoding to JPEG is actually
less than 500ms. Scaling seems to take 4.5seconds! But I'm a little
confused: I thought - ok, if getTiles() forces computation for the scale
operation, perhaps I will have to do the same for the crop operation to
get an accurate timing of it! But when I do getTiles() after the crop
operation, it turns into another 4.5sec operation (for a total time of
10+sec!) So, obviously doing a getTiles() on the crop operation to get
more 'accurate' timing wasn't helping things. So I'm more than a bit
confused as to timing things properly.

Anyway, assuming that my 200mb TIFF source image is not tiled and that
I always want to crop the image and output to a JPEG of size 700x"some-
height-that-maintains-aspect-ratio", what is the optimal way to go?
(The source images are high-resolution plant specimen images.)

Thanks everyone for your patience in answering my questions.
Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Brian Burkhalter

The GIF writer in JAI-Image I/O Tools will write an image which satisfies
all the following conditions:

* sampleModel.getNumBands() == 1
* sampleModel.getSampleSize()[0] <= 8
* colorModel.getComponentSize()[0] <= 8

The ColorModel does not have to be an IndexColorModel but if it is not a gray
colortable will be created.

Brian

On Thu, 30 Jun 2005, Nidel, Mike wrote:

> Personally I've never written a GIF image. However, I
> believe you need to convert your image to an Indexed
> color image before writing it as a GIF. I would have
> expected the code to throw an error when trying to write
> the GIF, but that's probably a separate issue.
>
> Mike
>
> > -----Original Message-----
> > From: Thomas Wolf [mailto:twolf@ithaka.org]
> > Sent: Thursday, June 30, 2005 4:17 PM
> > To: interest@jai.dev.java.net
> > Subject: [JAI] GIF images corrupt?
> >
> >
> >
> > Hi,
> > I previously posted regarding the performance of taking a
> > huge (200meg) TIFF image, cropping, scaling, and then writing
> > it out as a JPEG. I asked the forum about possibiliies for
> > speeding things up. Since most of the time seemed to be
> > spent in the encoding of the JPEG, someone suggested encoding
> > into a simpler format - e.g. TIFF or GIF. But when I tried to
> > encode to GIF, my firefox browser prints the
> > message:
> > The image "http://localhost:8084/ja/ImageServer?imgType=gif..."
> > cannot be displayed, because it contains errors.
> > In IE, I just see the IE "placeholder" icon for the image.
> >
> > I'm using the following code to do the encoding - I don't see
> > how I can be doing anything wrong here - especially when it
> > works for the other image formats (JPEG, PNG, and TIFF) I've tried:
> >
> > workingImage = JAI.create("stream", stream);
> > ServletOutputStream out = response.getOutputStream();
> >
> > ...set parameter block for cropping...
> > workingImage = JAI.create("crop", pb);
> > ...set parameter block for scaling...
> > workingImage = JAI.create("scale", pb);
> > javax.imageio.ImageIO.write(workingImage, "gif", out);
> >
> > Does anyone have any clue why this could be happening? Many
> > thanks for all suggestions.
> >
> > Tom
> >
> > P.S. Environment: JDK 1.4.2, Tomcat 5.5.7, JAI 1.1.2_01, and
> > JIO 1.0_01 running on Windows XP. P.P.S. Do I need to worry
> > about synchronization between the scaling operation and the
> > final rendering? In the other thread on performance, I
> > mentioned that scaling appears to take less than a
> > millisecond when I print out the time before/after the
> > operation. James Cheng observed that the rendering might
> > have been defered?? If that's the case, perhaps I need to
> > wait with the final encoding until scaling is done? How is
> > this done? I'm a JAI novice.
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> > For additional commands, e-mail: interest-help@jai.dev.java.net
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

----------------
Brian Burkhalter
Advanced Development/Media & Entertainment
Market Development Engineering
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Nidel, Mike

I'll have to punt on how to convert to indexed color, although
there have been a LOT of questions on this topic on here. I'm
sure if you search the archives for "convert indexed color" or
something similar, you'll get your answer.

I wouldn't recommend going to GIF, however, unless you really
can tolerate the loss of color depth. I don't know what kind of
data is in your 200MB source image, but I don't think GIF is
the right format for anything other than maybe icons.

So you are cropping, scaling, then writing a JPEG from a 200MB
TIFF file. This brings us to the perennial question: is your
source image tiled? If not, then as soon as you ask for a single
pixel, you will probably end up reading the entire image into
memory. If this is the case, then I would say that reading 200MB
into main memory in 5 sec is probably not slow at all.

If your source image is tiled, then make sure you are not doing
anything to force it to read the entire image. It might be useful
to monitory the memory usage of your program (or a test program
if that helps you to isolate the issue better). If the heap grows
to 250MB unexpectedly, that might indicate that something you
don't expect is happening.

Specifically, when dealing with tiled images, make sure never
to call getData() or getTiles() on the image, and never to load
it into a BufferedImage. All of these will result in bringing
the tiles into memory, which in your case is not what you want.

I'm sorry I haven't been following the thread closely up to this
point -- if I've missed anything in the original details please
forgive me.

Mike

> -----Original Message-----
> From: Thomas Wolf [mailto:twolf@ithaka.org]
> Sent: Thursday, June 30, 2005 4:43 PM
> To: interest@jai.dev.java.net
> Subject: Re: [JAI] GIF images corrupt?
>
>
> Thanks Mike - forgive my ignorance, but how do I convert it
> to an indexed color image? Is it even worth it? The only
> reason I'm trying to convert the image to GIF is because I
> was hoping to shave some seconds off my
> 5+ second encoding time for JPEG....not sure how I would measure the
> 5+ real
> encoding time if James was right and the scaling operation
> time is happening during my encoding call.)
>
> Sorry for the stupid questions, but I don't find the
> tutorials on JAI/JIO terribly enlightening. There's not much
> guidance in terms of what's the "best" route to accomplish
> anything - I'm not doing anything fancy. Taking a large
> image and returning a part of it, scaled to the proper pixel
> dimensions and outputting in a format all browser ought to
> understand. I don't see why the process is taking 5+
> seconds....but maybe I'm just doing everything sub-optimally
> and just don't know.
>
> P.S. Looking at the JIO documentation page, I don't see GIF
> as a supported format - but reading the release notes, I see
> as one of the fixes the ability to correctly write GIF for
> certain images??
>
>
> Nidel, Mike wrote:
> > Personally I've never written a GIF image. However, I
> > believe you need to convert your image to an Indexed
> > color image before writing it as a GIF. I would have
> > expected the code to throw an error when trying to write
> > the GIF, but that's probably a separate issue.
> >
> > Mike
> >
> >
> >>-----Original Message-----
> >>From: Thomas Wolf [mailto:twolf@ithaka.org]
> >>Sent: Thursday, June 30, 2005 4:17 PM
> >>To: interest@jai.dev.java.net
> >>Subject: [JAI] GIF images corrupt?
> >>
> >>
> >>
> >>Hi,
> >>I previously posted regarding the performance of taking a
> >>huge (200meg) TIFF image, cropping, scaling, and then writing
> >>it out as a JPEG. I asked the forum about possibiliies for
> >>speeding things up. Since most of the time seemed to be
> >>spent in the encoding of the JPEG, someone suggested encoding
> >>into a simpler format - e.g. TIFF or GIF. But when I tried to
> >>encode to GIF, my firefox browser prints the
> >>message:
> >> The image "http://localhost:8084/ja/ImageServer?imgType=gif..."
> >> cannot be displayed, because it contains errors.
> >>In IE, I just see the IE "placeholder" icon for the image.
> >>
> >>I'm using the following code to do the encoding - I don't see
> >>how I can be doing anything wrong here - especially when it
> >>works for the other image formats (JPEG, PNG, and TIFF) I've tried:
> >>
> >>workingImage = JAI.create("stream", stream);
> >>ServletOutputStream out = response.getOutputStream();
> >>
> >>...set parameter block for cropping...
> >>workingImage = JAI.create("crop", pb);
> >>...set parameter block for scaling...
> >>workingImage = JAI.create("scale", pb);
> >>javax.imageio.ImageIO.write(workingImage, "gif", out);
> >>
> >>Does anyone have any clue why this could be happening? Many
> >>thanks for all suggestions.
> >>
> >>Tom
> >>
> >>P.S. Environment: JDK 1.4.2, Tomcat 5.5.7, JAI 1.1.2_01, and
> >>JIO 1.0_01 running on Windows XP. P.P.S. Do I need to worry
> >>about synchronization between the scaling operation and the
> >>final rendering? In the other thread on performance, I
> >>mentioned that scaling appears to take less than a
> >>millisecond when I print out the time before/after the
> >>operation. James Cheng observed that the rendering might
> >>have been defered?? If that's the case, perhaps I need to
> >>wait with the final encoding until scaling is done? How is
> >>this done? I'm a JAI novice.
> >>
> >>
> >>
> >>
> >>
> >>
> >>------------------------------------------------------------
> ---------
> >>To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> >>For additional commands, e-mail: interest-help@jai.dev.java.net
> >>
> >>
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> > For additional commands, e-mail: interest-help@jai.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Brian Burkhalter

On Thu, 30 Jun 2005, Nidel, Mike wrote:

> I'll have to punt on how to convert to indexed color, although
> there have been a LOT of questions on this topic on here. I'm
> sure if you search the archives for "convert indexed color" or
> something similar, you'll get your answer.

The archives up to April 15 are here

http://archives.java.sun.com/archives/jai-interest.html

and there is this information in the java.net archive:

https://jai.dev.java.net/servlets/ReadMsg?listName=interest&msgNo=65

> I wouldn't recommend going to GIF, however, unless you really
> can tolerate the loss of color depth. I don't know what kind of
> data is in your 200MB source image, but I don't think GIF is
> the right format for anything other than maybe icons.

Color quantization is not necessarily cheap either especially if you need to
compute an optimal color map.

> Specifically, when dealing with tiled images, make sure never
> to call getData() or getTiles() on the image, and never to load
> it into a BufferedImage. All of these will result in bringing
> the tiles into memory, which in your case is not what you want.

getTiles() is superior for tiled images if you just want to force the
computation as it will not cause a cobbling of all the tiles into a single
raster as will getData().

Brian

----------------
Brian Burkhalter
Advanced Development/Media & Entertainment
Market Development Engineering
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

James Cheng

> P.P.S. Do I need to worry about synchronization between the scaling operation
> and the final rendering? In the other thread on performance, I mentioned that
> scaling appears to take less than a millisecond when I print out the time
> before/after the operation. James Cheng observed that the rendering might
> have been defered?? If that's the case, perhaps I need to wait with the
> final encoding until scaling is done? How is this done? I'm a JAI novice.

In order to measure how much time an operator really costs, you
might have to do something like the following:

long t0 = System.currentTimeMillis();
workingImage = JAI.create("scale", pb);
workingImage.getTiles(); // force to compute
long t1 = System.currentTimeMillis();
System.out.println("Time spent in scale= "+(t1-t0));

Thanks,
-James

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Brian Burkhalter

On Thu, 30 Jun 2005, James Cheng wrote:

> > P.P.S. Do I need to worry about synchronization between the scaling operation
> > and the final rendering? In the other thread on performance, I mentioned that
> > scaling appears to take less than a millisecond when I print out the time
> > before/after the operation. James Cheng observed that the rendering might
> > have been defered?? If that's the case, perhaps I need to wait with the
> > final encoding until scaling is done? How is this done? I'm a JAI novice.
>
> In order to measure how much time an operator really costs, you
> might have to do something like the following:
>
> long t0 = System.currentTimeMillis();
> workingImage = JAI.create("scale", pb);
> workingImage.getTiles(); // force to compute
> long t1 = System.currentTimeMillis();
> System.out.println("Time spent in scale= "+(t1-t0));

This point needs to be emphasized. When you call JAI.create() all you are
doing is adding a RenderedOp node to a graph. You are not doing any
computation until the data are requested from that node unless the operation
is "immediate". To force data computation you need to do something like
getTiles() as shown above. To time operations separately you also need to
ensure that no upstream portions of the chain are being recomputed, for
example, if there are tiles which have been flushed from the cache.

Brian

----------------
Brian Burkhalter
Advanced Development/Media & Entertainment
Market Development Engineering
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Nidel, Mike

Personally I've never written a GIF image. However, I
believe you need to convert your image to an Indexed
color image before writing it as a GIF. I would have
expected the code to throw an error when trying to write
the GIF, but that's probably a separate issue.

Mike

> -----Original Message-----
> From: Thomas Wolf [mailto:twolf@ithaka.org]
> Sent: Thursday, June 30, 2005 4:17 PM
> To: interest@jai.dev.java.net
> Subject: [JAI] GIF images corrupt?
>
>
>
> Hi,
> I previously posted regarding the performance of taking a
> huge (200meg) TIFF image, cropping, scaling, and then writing
> it out as a JPEG. I asked the forum about possibiliies for
> speeding things up. Since most of the time seemed to be
> spent in the encoding of the JPEG, someone suggested encoding
> into a simpler format - e.g. TIFF or GIF. But when I tried to
> encode to GIF, my firefox browser prints the
> message:
> The image "http://localhost:8084/ja/ImageServer?imgType=gif..."
> cannot be displayed, because it contains errors.
> In IE, I just see the IE "placeholder" icon for the image.
>
> I'm using the following code to do the encoding - I don't see
> how I can be doing anything wrong here - especially when it
> works for the other image formats (JPEG, PNG, and TIFF) I've tried:
>
> workingImage = JAI.create("stream", stream);
> ServletOutputStream out = response.getOutputStream();
>
> ...set parameter block for cropping...
> workingImage = JAI.create("crop", pb);
> ...set parameter block for scaling...
> workingImage = JAI.create("scale", pb);
> javax.imageio.ImageIO.write(workingImage, "gif", out);
>
> Does anyone have any clue why this could be happening? Many
> thanks for all suggestions.
>
> Tom
>
> P.S. Environment: JDK 1.4.2, Tomcat 5.5.7, JAI 1.1.2_01, and
> JIO 1.0_01 running on Windows XP. P.P.S. Do I need to worry
> about synchronization between the scaling operation and the
> final rendering? In the other thread on performance, I
> mentioned that scaling appears to take less than a
> millisecond when I print out the time before/after the
> operation. James Cheng observed that the rendering might
> have been defered?? If that's the case, perhaps I need to
> wait with the final encoding until scaling is done? How is
> this done? I'm a JAI novice.
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Thomas Wolf

Thanks Mike - forgive my ignorance, but how do I convert it to an indexed
color image? Is it even worth it? The only reason I'm trying to convert
the image to GIF is because I was hoping to shave some seconds off my
5+ second encoding time for JPEG....not sure how I would measure the real
encoding time if James was right and the scaling operation time is happening
during my encoding call.)

Sorry for the stupid questions, but I don't find the tutorials on JAI/JIO
terribly enlightening. There's not much guidance in terms of what's the
"best" route to accomplish anything - I'm not doing anything fancy. Taking
a large image and returning a part of it, scaled to the proper pixel
dimensions and outputting in a format all browser ought to understand. I
don't see why the process is taking 5+ seconds....but maybe I'm just doing
everything sub-optimally and just don't know.

P.S. Looking at the JIO documentation page, I don't see GIF as a supported
format - but reading the release notes, I see as one of the fixes the ability
to correctly write GIF for certain images??

Nidel, Mike wrote:
> Personally I've never written a GIF image. However, I
> believe you need to convert your image to an Indexed
> color image before writing it as a GIF. I would have
> expected the code to throw an error when trying to write
> the GIF, but that's probably a separate issue.
>
> Mike
>
>
>>-----Original Message-----
>>From: Thomas Wolf [mailto:twolf@ithaka.org]
>>Sent: Thursday, June 30, 2005 4:17 PM
>>To: interest@jai.dev.java.net
>>Subject: [JAI] GIF images corrupt?
>>
>>
>>
>>Hi,
>>I previously posted regarding the performance of taking a
>>huge (200meg) TIFF image, cropping, scaling, and then writing
>>it out as a JPEG. I asked the forum about possibiliies for
>>speeding things up. Since most of the time seemed to be
>>spent in the encoding of the JPEG, someone suggested encoding
>>into a simpler format - e.g. TIFF or GIF. But when I tried to
>>encode to GIF, my firefox browser prints the
>>message:
>> The image "http://localhost:8084/ja/ImageServer?imgType=gif..."
>> cannot be displayed, because it contains errors.
>>In IE, I just see the IE "placeholder" icon for the image.
>>
>>I'm using the following code to do the encoding - I don't see
>>how I can be doing anything wrong here - especially when it
>>works for the other image formats (JPEG, PNG, and TIFF) I've tried:
>>
>>workingImage = JAI.create("stream", stream);
>>ServletOutputStream out = response.getOutputStream();
>>
>>...set parameter block for cropping...
>>workingImage = JAI.create("crop", pb);
>>...set parameter block for scaling...
>>workingImage = JAI.create("scale", pb);
>>javax.imageio.ImageIO.write(workingImage, "gif", out);
>>
>>Does anyone have any clue why this could be happening? Many
>>thanks for all suggestions.
>>
>>Tom
>>
>>P.S. Environment: JDK 1.4.2, Tomcat 5.5.7, JAI 1.1.2_01, and
>>JIO 1.0_01 running on Windows XP. P.P.S. Do I need to worry
>>about synchronization between the scaling operation and the
>>final rendering? In the other thread on performance, I
>>mentioned that scaling appears to take less than a
>>millisecond when I print out the time before/after the
>>operation. James Cheng observed that the rendering might
>>have been defered?? If that's the case, perhaps I need to
>>wait with the final encoding until scaling is done? How is
>>this done? I'm a JAI novice.
>>
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
>>For additional commands, e-mail: interest-help@jai.dev.java.net
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net

Brian Burkhalter

On Thu, 30 Jun 2005, Thomas Wolf wrote:

> Thanks Mike - forgive my ignorance, but how do I convert it to an indexed
> color image? Is it even worth it? The only reason I'm trying to convert
> the image to GIF is because I was hoping to shave some seconds off my
> 5+ second encoding time for JPEG....not sure how I would measure the real
> encoding time if James was right and the scaling operation time is happening
> during my encoding call.)

James is correct as mentioned elsewhere.

> Sorry for the stupid questions, but I don't find the tutorials on JAI/JIO
> terribly enlightening. There's not much guidance in terms of what's the
> "best" route to accomplish anything - I'm not doing anything fancy. Taking
> a large image and returning a part of it, scaled to the proper pixel
> dimensions and outputting in a format all browser ought to understand. I
> don't see why the process is taking 5+ seconds....but maybe I'm just doing
> everything sub-optimally and just don't know.

Well, given the number of possible combinations of operations it is nigh
impossible to describe the "best" route for each case.

> P.S. Looking at the JIO documentation page, I don't see GIF as a supported
> format - but reading the release notes, I see as one of the fixes the ability
> to correctly write GIF for certain images??

GIF is mentioned on the package summary page in the javadoc

http://java.sun.com/products/java-media/jai/forDevelopers/jai-imageio-1_...

as well as in the README file

http://java.sun.com/products/java-media/jai/README-jai_imageio-1_1.html

Brian

----------------
Brian Burkhalter
Advanced Development/Media & Entertainment
Market Development Engineering
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net