You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Thomas DeWeese <Th...@Kodak.com> on 2003/12/01 13:34:48 UTC

Re: Compress created TIFF-image

Thomas DeWeese wrote:

> Gergely Hajdu wrote:

>> I have created a TIFF-image by converting a svg-file(called Image.xml)
>> to a TIFF :
>>
>> My problem is that the image is WAY to big in bytesize (4GB..).
>> I would need to compress it to app. max 50 000 bytes.
>> How do I compress this image as MUCH as possible ?

    So I thought about this again, I missed a factor of 1000. You are
asking for about 100,000 to 1 compression.  Your 4GB image must be
around 30,000 by 30,000 pixels who gave you a requirement of 50K
bytes?  It's insane!

    Perhaps you really want to rasterize the image at a lower
resolution?   Like screen resolution?  This would make a _lot_
more sense with the 50K figure.

>   I don't know that you will succeed in compressing by over 100 to 1!
> But for these sorts of large images you really want to use the
> 'tiled image transcoder' that you can find in the contrib directory
> of the Batik source dist.
> 
>> I have looked at "org.apache.batik.ext.awt.image.codec.tiff",
>> where I can compress the image,but I don't know how to "glue" this 
>> together
>> with my created image ?
> 
> 
>   As a bonus the tiled Image transcoder exposes the TIFFImageEncoder
> class directly so you can create TIFFEncodeParam.  You could try using
> deflate compression but I think you will only get close to the 100:1
> compression using JPEG.  But I really think your goal is totally
> out of bounds.
> 
>> Probably I have to do some manipulating with the transcoder before
>> transcoding the image ?
>>
>> Thanks in advance !
>> /Gergely
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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


Re: Compress created TIFF-image

Posted by Robert Casties <ca...@mpiwg-berlin.mpg.de>.
Gergely Hajdu wrote:

> I have tried to do this rasterization, but I cant get the code/parameters
> right. How do I easily make this rasterization at a lower resolution ?
> Since I am really stuck, code samples would be gratefully accepted.
> For now, my code just looks like :

For the resolution you need to add something like

		// destination image dimensions
		if (paramDW > 0) {
			transcoder.addTranscodingHint(
				SVGAbstractTranscoder.KEY_WIDTH,
					new Float(paramDW));
		}
		if (paramDH > 0) {
			transcoder.addTranscodingHint(
				SVGAbstractTranscoder.KEY_HEIGHT,
					new Float(paramDH));
		}

The TIFF encoder doesn't seem to have the KEY_INDEXED number of colors 
that the PNG trancoder has to specifiy the number of color in the 
resulting index color model.

So you would have to experiment with your TIFFs, or try PNG.

Cheers
	Robert

P.S. the javadoc of TIFFTranscoder or PNGTranscoder is your friend.


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


R: Images in jar. Sample

Posted by Fabio Biscaro <bi...@webscience.it>.
Thank for help!

This morning i noticed that my error was really the "/" after !.

Thanks!

Fabio

-----Messaggio originale-----
Da: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com] 
Inviato: martedì 2 dicembre 2003 19.24
A: Batik Users
Oggetto: Re: Images in jar. Sample


Fabio Biscaro wrote:

> Here i post an example of an svg that i would like to have in a jar. 
> You can unzip it in your root directory.
> 
> I tried to load it by using this java code:
> 
> svgCanvas.setUri("jar:file:/jar/qco.jar!prova.svg");
> ( I tried other combinations too)

    The following is what I used on a Windows box and it worked:

jar:file:d:/batik/test/jartest/qco.jar\!/prova.svg

    Most notable the '/' after '!'.  It appears this is required.

> But no way. I cant get rid of "Unable to make sense of URL 
> connection"!




---------------------------------------------------------------------
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


Re: Images in jar. Sample

Posted by Thomas DeWeese <Th...@Kodak.com>.
Fabio Biscaro wrote:

> Here i post an example of an svg that i would like to have in a jar.
> You can unzip it in your root directory.
> 
> I tried to load it by using this java code:
> 
> svgCanvas.setUri("jar:file:/jar/qco.jar!prova.svg");
> ( I tried other combinations too)

    The following is what I used on a Windows box and it worked:

jar:file:d:/batik/test/jartest/qco.jar\!/prova.svg

    Most notable the '/' after '!'.  It appears this is required.

> But no way. I cant get rid of "Unable to make sense of URL connection"!




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


Images in jar. Sample

Posted by Fabio Biscaro <bi...@webscience.it>.
Here i post an example of an svg that i would like to have in a jar.
You can unzip it in your root directory.

I tried to load it by using this java code:

svgCanvas.setUri("jar:file:/jar/qco.jar!prova.svg");
( I tried other combinations too)

But no way. I cant get rid of "Unable to make sense of URL connection"!

Can you help me?

Thanks, 
Fabio


RE: Compress created TIFF-image

Posted by Gergely Hajdu <gh...@abprodata.com>.
I have tried to do this rasterization, but I cant get the code/parameters
right. How do I easily make this rasterization at a lower resolution ?
Since I am really stuck, code samples would be gratefully accepted.
For now, my code just looks like :

// create a JPEG transcoder
TIFFTranscoder transcoder = new TIFFTranscoder();

// create the transcoder input
String svgURI = new File("Images/TestImage.svg").toURL().toString();
TranscoderInput input = new TranscoderInput(svgURI);

// create the transcoder output
OutputStream ostream = new
FileOutputStream("Archived_Images/TestImage.tif");
TranscoderOutput output = new TranscoderOutput(ostream);

// save the image
transcoder.transcode(input, output);

// flush and close the stream then exit
ostream.flush();
ostream.close();
System.exit(0);

So could the helping hand show me where/how to fill in the missing code
to do this lower reolution approach ? As I wrote before, I dont know which
classes/librairies/methods to use...

Thanks in advance
/Gergely

-----Original Message-----
From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
Sent: Monday, December 01, 2003 1:35 PM
To: Batik Users
Subject: Re: Compress created TIFF-image


Thomas DeWeese wrote:

> Gergely Hajdu wrote:

>> I have created a TIFF-image by converting a svg-file(called Image.xml)
>> to a TIFF :
>>
>> My problem is that the image is WAY to big in bytesize (4GB..).
>> I would need to compress it to app. max 50 000 bytes.
>> How do I compress this image as MUCH as possible ?

    So I thought about this again, I missed a factor of 1000. You are
asking for about 100,000 to 1 compression.  Your 4GB image must be
around 30,000 by 30,000 pixels who gave you a requirement of 50K
bytes?  It's insane!

    Perhaps you really want to rasterize the image at a lower
resolution?   Like screen resolution?  This would make a _lot_
more sense with the 50K figure.

>   I don't know that you will succeed in compressing by over 100 to 1!
> But for these sorts of large images you really want to use the
> 'tiled image transcoder' that you can find in the contrib directory
> of the Batik source dist.
>
>> I have looked at "org.apache.batik.ext.awt.image.codec.tiff",
>> where I can compress the image,but I don't know how to "glue" this
>> together
>> with my created image ?
>
>
>   As a bonus the tiled Image transcoder exposes the TIFFImageEncoder
> class directly so you can create TIFFEncodeParam.  You could try using
> deflate compression but I think you will only get close to the 100:1
> compression using JPEG.  But I really think your goal is totally
> out of bounds.
>
>> Probably I have to do some manipulating with the transcoder before
>> transcoding the image ?
>>
>> Thanks in advance !
>> /Gergely
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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




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


Re: Compress created TIFF-image

Posted by Robert Casties <ca...@mpiwg-berlin.mpg.de>.
Gergely Hajdu wrote:

> Hi Thomas,
> 
> The quality of the picture is REALLY not important. It
> will just contain plain text, so resolution/number of colours
> etc. etc. is absolutely not important. As long as the text can
> be seen it is enough.
> 
> The reason why I think it can be compressed this much is that
> the TIFF without any compressing is 4 GB. But I first created a PDF
> with FOP and then found a tool that converts PDF to TIFF. With 
> this tool, the TIFF-image became 20 000 bytes. The problem is that
> this tool is NOT for free...

What pixel-size did that TIFF image have?

If you're dabbling in TIFF you should try to install libtiff (works on 
any Unix and Windows AFAIK) which has a small program "tiffinfo" that 
prints a lot of useful information about a TIFF image.

You can get rather high compression rates in TIFF by using bilevel 
(black and white) with CCITT-G4 encoding if your images have large white 
or black areas.

Otherwise the only way to reach such a compression rate is lossy 
encoding like JPEG.

For doing anything image-related in Java have a look at:

http://www.geocities.com/marcoschmidt.geo/java-image-coding.html

Cheers
	Robert


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


RE: Compress created TIFF-image

Posted by Gergely Hajdu <gh...@abprodata.com>.
Hi Thomas,

The quality of the picture is REALLY not important. It
will just contain plain text, so resolution/number of colours
etc. etc. is absolutely not important. As long as the text can
be seen it is enough.

The reason why I think it can be compressed this much is that
the TIFF without any compressing is 4 GB. But I first created a PDF
with FOP and then found a tool that converts PDF to TIFF. With 
this tool, the TIFF-image became 20 000 bytes. The problem is that
this tool is NOT for free...

As I wrote previously, I am REALLY new to graphics, i.e I don't 
even know what raserization is :=) So ANY help will be grately
appreciated (librairies/classes/methods) etc. etc.! As input, I
will have a TIFF-image.

Thanks for taking time helping me !
/Gergely 

-----Original Message-----
From: Thomas DeWeese [mailto:Thomas.DeWeese@Kodak.com]
Sent: Monday, December 01, 2003 1:35 PM
To: Batik Users
Subject: Re: Compress created TIFF-image


Thomas DeWeese wrote:

> Gergely Hajdu wrote:

>> I have created a TIFF-image by converting a svg-file(called Image.xml)
>> to a TIFF :
>>
>> My problem is that the image is WAY to big in bytesize (4GB..).
>> I would need to compress it to app. max 50 000 bytes.
>> How do I compress this image as MUCH as possible ?

    So I thought about this again, I missed a factor of 1000. You are
asking for about 100,000 to 1 compression.  Your 4GB image must be
around 30,000 by 30,000 pixels who gave you a requirement of 50K
bytes?  It's insane!

    Perhaps you really want to rasterize the image at a lower
resolution?   Like screen resolution?  This would make a _lot_
more sense with the 50K figure.

>   I don't know that you will succeed in compressing by over 100 to 1!
> But for these sorts of large images you really want to use the
> 'tiled image transcoder' that you can find in the contrib directory
> of the Batik source dist.
> 
>> I have looked at "org.apache.batik.ext.awt.image.codec.tiff",
>> where I can compress the image,but I don't know how to "glue" this 
>> together
>> with my created image ?
> 
> 
>   As a bonus the tiled Image transcoder exposes the TIFFImageEncoder
> class directly so you can create TIFFEncodeParam.  You could try using
> deflate compression but I think you will only get close to the 100:1
> compression using JPEG.  But I really think your goal is totally
> out of bounds.
> 
>> Probably I have to do some manipulating with the transcoder before
>> transcoding the image ?
>>
>> Thanks in advance !
>> /Gergely
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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




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