Skip to main content

Transcoding large image files

2 replies [Last post]
jppowell
Offline
Joined: 2007-03-14
Points: 0

Hi all,

I have followed the example listed here: http://java.sun.com/products/java-media/jai/forDevelopers/jai1_0_1guide-...

In my case, however, I am trying to turn a 4gb bmp into a jpg. I get java out of heap space errors on the line encoder.encode(img) in the function encodeImage. I don't understand why, as nothing is being buffered.

Any pointers greatly appreciated.

John

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bpb
Offline
Joined: 2004-06-23
Points: 0

Unfortunately all JPEG writers (Java SE and JAI Image I/O Tools) require the entire image to be in memory in order to perform the JPEG compression. An enhancement issue, #117 of the jai-imageio-core project, has been filed against this. If you are interested please vote for this issue.

Brian

> Hi all,
>
> I have followed the example listed here:
> http://java.sun.com/products/java-media/jai/forDevelop
> ers/jai1_0_1guide-unc/Encode.doc.html#55335
>
> In my case, however, I am trying to turn a 4gb bmp
> into a jpg. I get java out of heap space errors on
> the line encoder.encode(img) in the function
> encodeImage. I don't understand why, as nothing is
> being buffered.
>
> Any pointers greatly appreciated.
>
> John

bpb
Offline
Joined: 2004-06-23
Points: 0

Sorry I see that this had already been dealt with including the vote. Please disregard my response below.

Brian

> Unfortunately all JPEG writers (Java SE and JAI Image
> I/O Tools) require the entire image to be in memory
> in order to perform the JPEG compression. An
> enhancement issue, #117 of the jai-imageio-core
> project, has been filed against this. If you are
> interested please vote for this issue.
>
> Brian
>
> > Hi all,
> >
> > I have followed the example listed here:
> >
> http://java.sun.com/products/java-media/jai/forDevelop
>
> > ers/jai1_0_1guide-unc/Encode.doc.html#55335
> >
> > In my case, however, I am trying to turn a 4gb bmp
> > into a jpg. I get java out of heap space errors on
> > the line encoder.encode(img) in the function
> > encodeImage. I don't understand why, as nothing is
> > being buffered.
> >
> > Any pointers greatly appreciated.
> >
> > John