xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GVS Srinivas <GVS.Srini...@cramer.co.uk>
Subject RE: outofmemory error in batik transcoder
Date Thu, 23 Oct 2003 10:41:50 GMT


hi,
thanks for the suggestion of tiffencoding.i still didnt get through doing
that.
one more suggestion..
there are some JPEGTranscoding hints like Key_Quality, KEY_PIXEL_TO_MM.does
the memory blowing up decrease by adjusting these values,please suggest.
thanks a lot
GVS

-----Original Message-----
From: GVS Srinivas 
Sent: Wednesday, October 22, 2003 3:55 PM
To: 'Batik Users'
Subject: RE: outofmemory error in batik transcoder


i saw this snippet of code

================================================
	OutputStream out = new FileOutputStream(fileName);
 	TIFFEncodeParam param = new TIFFEncodeParam();
 	param.setCompression(TIFFEncodeParam.COMPRESSION_JPEG_TTN2);
 	ImageEncoder encoder = ImageCodec.createImageEncoder("TIFF", out,
param);
 	encoder.encode(firstImage);
	out.close();
=================================================
but in the above code i see that encode mathod of the encoder takes the
image.
i am invoking the TiledImageTranscoder to raster a tiff image.can i, on the
fly give the tiff image as the input to the image encoder so that it encodes
in the JPEG format.i dont want to create a tiff image first on the disk and
then access the image to encode it to the jpeg.please suggest me
thanks a lot again.
GVS


-----Original Message-----
From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
Sent: Wednesday, October 22, 2003 12:56 PM
To: Batik Users
Subject: Re: outofmemory error in batik transcoder


GVS Srinivas wrote:

> thanks for the input thomas,
> i think saving image of size 400 mb of an image cant be afforded by us.

   Well, you might try using one of the supported forms of compressed Tiff.
This includes JPEG Compression. The second argument to the TIFFImageEncoder
is a TIFFEncodeParam object.  You can construct one and call:

    param.setCompression(TIFFEncodeParam.COMPRESSION_JPEG_TTN2);

   To turn on JPEG compression of the image data (the file is still a Tiff
file).
The encoder also supports, COMPRESSION_PACKBITS (a run length encoding), and
COMPRESSION_DEFLATE ("gzip" compression).  To be honest I've never really
tried
either of these but the TIFF Encoder we use (from JAI) should support them.

   Also these are getting pretty far "off the beaten path" for Tiff files so
what ever software you are using down stream may or may not be able to read
them.

> i tried the other option of increasing the memory of java while starting
my
> tomcat(Xmx512m ),i observed an improvement but still it seems to choke the
> memory.Is there any plan of batik enhancing the JPEGTranscoder?.

    I don't have any plans. The biggest problem is that the com.sun JPEG
encoder
which we use takes the entire image at one time (no tiled interface).  BTW
for a 400MB image you will need to give it at least a Gig of memory as
I know it needs to copy that image at least once for output (800MB).

> thanks a lot for the support.
> regds
> GVS
> 
> -----Original Message-----
> From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
> Sent: Tuesday, October 21, 2003 7:31 PM
> To: Batik Users
> Subject: Re: outofmemory error in batik transcoder
> 
> 
> GVS Srinivas wrote:
> 
> 
>>hi ,
>>thanks for the info.
>>i tried using TiledImageTranscoder 
>>1. it was saying that the constrcutor is protected.
> 
> 
>     The file has it's own main which was intended to construct the
> Transcoder, but I don't think there is much of a problem making it
> public for use in a larger application.
> 
> 
>>2.i made the constructor public and tried instantiating i tried in the
>>following way
>>====================================
>>		FileOutputStream fos = new FileOutputStream("d:\\gvs.tiff");
>>            TiledImageTranscoder tit = new TiledImageTranscoder();
>>            tit.addTranscodingHint(KEY_WIDTH, new Float(10240));
>>            tit.transcode(new TranscoderInput("file:" + "d:\\test.svg"), 
>>                          new TranscoderOutput(fos));
>>====================================
>>it was creating a file as large as 400MB.i am not sure where iam commiting
>>some mistake.please help me out.
> 
> 
>     I don't think there is a mistake, the Tiff file is uncompressed,
> so assuming a mostly square document:  4*10,000*10,000 = 400,000,000 bytes
=
> 400MB.
> (That is 4 bytes per pixel * 10,000 pixels across * 10,000 pixels down).
> 
> 
>>thanks
>>GVS
>>
>>-----Original Message-----
>>From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
>>Sent: Tuesday, October 21, 2003 3:52 PM
>>To: Batik Users
>>Subject: Re: outofmemory error in batik transcoder
>>
>>
>>Felicia Ionascu wrote:
>>
>>
>>
>>>Hi,
>>>I had the same problem several months ago, you can use the 
>>>TiledImageTranscoder instead of your JPEG transcoder, of course you need 
>>>to change "TIF" to "JPEG" in the code. This transcoder doesn't use 
>>>BufferedImages but RenderedImages, so it decreases dramatically the 
>>>memory consumption.
>>>The source is in the "contrib" area of the CVS, thanks to Thomas.
>>
>>
>>   Actually, you can't just replace TIFF with JPEG in the code because
>>there is no JPEG encoder capable of taking a rendered image and
> 
> transcoding
> 
>>it to a JPEG file (Actually I think javax.imageio may have one but we
>>are currently based on JDK 1.3 so in that context we don't have it).
>>
>>   But it is true that if you can switch to using TIFF then the tiled
>>transcoder
>>is _much_ better for very large images.
>>
>>
>>
>>>Felicia
>>>
>>>
>>>
>>>GVS Srinivas wrote:
>>>
>>>
>>>
>>>>hi  all ,
>>>>i am  trying to transform a large svg into an jpg image using batik jpeg
>>>>transcoder and i am encoutering with outofmemoryerror.
>>>>when the transcode method is called from the jpegtranscoder.
>>>>
>>
>>
>
1.jpegtrascoder---------->>>>>2.imagetranscoder.transcode()----------->>>>3.
> 
>>
>
Staticrenderer.repaint()----------->>>>>>4.Staticrenderer.updateWorkingBuffe
> 
>>
>>>>rs()------>>>>5. Raster.createWritableRaster().after this i am
geting
the
>>>>outofmemoryerror.
>>>>when i debug the code actual wrror is coming in the in databufferInt 
>>>>class.
>>>>
>>>>would you please send me the code for correcting this problem in the 
>>>>batik
>>>>thanks a lot
>>>>GVS
>>>>
>>>>---------------------------------------------------------------------
>>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>>
>>>>
>>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>>
>>>
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>>
>>_____________________________________________________________________
>>This e-mail has been scanned for viruses by MCI's Internet Managed
> 
> Scanning
> 
>>Services - powered by MessageLabs. For further information visit
>>http://www.mci.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
>>For additional commands, e-mail: batik-users-help@xml.apache.org
>>
>>
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 
> 
> _____________________________________________________________________
> This e-mail has been scanned for viruses by MCI's Internet Managed
Scanning
> Services - powered by MessageLabs. For further information visit
> http://www.mci.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: batik-users-help@xml.apache.org
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


_____________________________________________________________________
This e-mail has been scanned for viruses by MCI's Internet Managed Scanning
Services - powered by MessageLabs. For further information visit
http://www.mci.com

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message