Skip to main content

OutOfMemory in J2K compression of very large TiledImage

4 replies [Last post]
scyudits
Offline
Joined: 2005-07-15

I am getting an OutOfMemoryError per the stack trace below. The tiling parameter to J2KImageWriteParam is set to be width = 104, height = 104. The total image dimensions are width = 5828, height = 7957.

The relevant code is:

TiledImage ti = /* very large tiled image */
im = new IIOImage(ti, null, writer.getDefaultImageMetadata(new ImageTypeSpecifier(ti), jiwp));
writer.write(null, im, jiwp);

Why am I getting this error? My understanding is that JPEG2000 supports any image size. Is there an alternative way to compress a very large TiledImage using J2KImageWriter?

java.lang.OutOfMemoryError
at jj2000.j2k.entropy.encoder.EBCOTRateAllocator.(EBCOTRateAllocator.java:346)
at jj2000.j2k.entropy.encoder.PostCompRateAllocator.createInstance(PostCompRateAllocator.java:258)
at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriter.write(J2KImageWriter.java:325)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
scyudits
Offline
Joined: 2005-07-15

Unfortunately I do not have that option, because my implementation runs on the server side.

(sorry forgot to quote your response previously)

> Did you increase the Java heap size limit using the
> "-mx" command line option?
>
> Brian
>
> On Tue, 2 May 2006, jai-imageio@javadesktop.org
> wrote:
>
> > I am getting an OutOfMemoryError per the stack
> trace below. The tiling parameter to
> J2KImageWriteParam is set to be width = 104, height =
> 104. The total image dimensions are width = 5828,
> height = 7957.
> >
> > The relevant code is:
> >
> > TiledImage ti = /* very large tiled image */
> > im = new IIOImage(ti, null,
> writer.getDefaultImageMetadata(new
> ImageTypeSpecifier(ti), jiwp));
> > writer.write(null, im, jiwp);
> >
> > Why am I getting this error? My understanding is
> that JPEG2000 supports any image size. Is there an
> alternative way to compress a very large TiledImage
> using J2KImageWriter?
> >
> > java.lang.OutOfMemoryError
> > at
> jj2000.j2k.entropy.encoder.EBCOTRateAllocator.(E
> BCOTRateAllocator.java:346)
> > at
> jj2000.j2k.entropy.encoder.PostCompRateAllocator.creat
> eInstance(PostCompRateAllocator.java:258)
> > at
> com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWri
> ter.write(J2KImageWriter.java:325)
> > [Message sent by forum member 'scyudits'
> (scyudits)]
> >
> >
> http://forums.java.net/jive/thread.jspa?messageID=1095
> 50
> >
> >
> ------------------------------------------------------
> ---------------
> > To unsubscribe, e-mail:
> interest-unsubscribe@jai-imageio.dev.java.net
> > For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net
> >
> >
>
> ----------------
> Brian Burkhalter
> Java Media, Imaging, and Graphics
> 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-imageio.dev.java.net
> For additional commands, e-mail:
> interest-help@jai-imageio.dev.java.net

scyudits
Offline
Joined: 2005-07-15

So there is no scalable way to compress images with JPEG2000 using ImageIO?

Brian Burkhalter

Did you increase the Java heap size limit using the "-mx" command line option?

Brian

On Tue, 2 May 2006, jai-imageio@javadesktop.org wrote:

> I am getting an OutOfMemoryError per the stack trace below. The tiling parameter to J2KImageWriteParam is set to be width = 104, height = 104. The total image dimensions are width = 5828, height = 7957.
>
> The relevant code is:
>
> TiledImage ti = /* very large tiled image */
> im = new IIOImage(ti, null, writer.getDefaultImageMetadata(new ImageTypeSpecifier(ti), jiwp));
> writer.write(null, im, jiwp);
>
> Why am I getting this error? My understanding is that JPEG2000 supports any image size. Is there an alternative way to compress a very large TiledImage using J2KImageWriter?
>
> java.lang.OutOfMemoryError
> at jj2000.j2k.entropy.encoder.EBCOTRateAllocator.(EBCOTRateAllocator.java:346)
> at jj2000.j2k.entropy.encoder.PostCompRateAllocator.createInstance(PostCompRateAllocator.java:258)
> at com.sun.media.imageioimpl.plugins.jpeg2000.J2KImageWriter.write(J2KImageWriter.java:325)
> [Message sent by forum member 'scyudits' (scyudits)]
>
> http://forums.java.net/jive/thread.jspa?messageID=109550
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
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-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

scyudits
Offline
Joined: 2005-07-15

Unfortunately I do not have that option, because my implementation runs on the server side.