Gergely Hajdu wrote:
I managed to insert the white rectangle. Now some different questions :
1.Why can't the image be seen if a compress it ? My code for doing this is the following :
Why can't the image be seen where? I could believe that the software you are using to view them doesn't support the types of TIFF compression used. 'Baseline' Tiff does not include any compression (and even that is not very completely supported) - so these are all 'extended' Tiffs.
2.When I want to see the image, the text can't be seen. It's very fuzzy, as if it was scaled in some way. Any ideas ?
This is because your image is only 100x100 pixels (which on most monitors is a 1-1.25 inch square of screen space at 1:1). I suspect that you will need to render at a higher resolution (and hence generate a larger file).
If you are dealing with simple black text on a white background you really want to go to 1bpp (to 4bpp) or something similar this would net you something like a 10-30x compression up front. But this would require writing a Rendered Op.
hgAnd as usual, big thanks for helping me. If it would be possible, I would definitely buy you a beer for all the help you have given me :=)
Regards /Gergely
-----Original Message----- From: Thomas DeWeese [mailto:[EMAIL PROTECTED] Sent: Friday, December 05, 2003 6:53 PM To: Batik Users Subject: Re: How to use "org.apache.batik.ext.awt.image.codec.tiff " ?
Gergely Hajdu wrote:
I misunderstood you, thinking #1 was not so easy either. But I'll go for that suggestion.I am almost ashamed to ask, but how do you that, and when...? Sorry, but I'm really a novice on graphics, and all thats concerning with it.
This is all DOM stuff (more or less of the top of my head so it may not compile right away).
String svgns = "http://www.w3.org/2000/svg"; Element rect = document.createElementNS(svgns, "rect"); rect.setAttribute("x", "0"); rect.setAttribute("y", "0"); rect.setAttribute("width", "100%"); rect.setAttribute("height", "100%"); rect.setAttribute("fill", "white"); Element root = document.getRootElement(); root.insertBefore(rect, root.getFirstChild());
I think it will be enough to add the rectangle on the fly, just for the transcoding purposes. Where should this code be inserted and how does the lines to be inserted look line in TiledImageEncoder ? Or is it a big task to creata the rectangle ?
Add it before calling the baseclass transcode method.
And again, great thanks for helping me. /Gergely
-----Original Message----- From: Thomas DeWeese [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 7:01 PM To: Batik Users Subject: Re: How to use "org.apache.batik.ext.awt.image.codec.tiff " ?
Gergely Hajdu wrote:
Honestly, my needs are absolutely not so big at all concerning the quality of the TIFF. Actually I just plain text I want to visualise, on white/transparent background with black text. So as long as the text can be seen, I wil be satisfied :=)
Huh, isn't there any easier way to achieve this than the two suggestions you are giving :=) ? Otherwise, I am afraid I will mailbomb this/other forum for a while...
I gave three, add a white rectangle to the SVG (perhaps on the fly only for transcoding purposes), use software that understands alpha channels and write code to flatten (implement the background color hint basically).
I can understand that #2 may be out, #3 may be more work than you want to do (although it might open the door for other enhancements like going to 1bpp), but what is wrong with #1?
As I mentioned, I just need to be able to see the text. In the "worst"
case
maybe other colors can be used to than black/white if it makes a solution easier.
Regards /Gergely
-----Original Message----- From: Thomas DeWeese [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 5:11 PM To: Batik Users Subject: Re: How to use "org.apache.batik.ext.awt.image.codec.tiff " ?
Gergely Hajdu wrote:
Finally Thomas, I've managed to run the program :=) But there are just a small bit missing....The created TIFF-image can't be viewed, I just see a black background.
Actually you are seeing opaque black text on a transparent black background :) You either need to insert an opaque white rectangle into the SVG source (before everything else). Use software that understands alpha channels, or write code to 'flatten the image' (* this is non-trivial).
tit.addTranscodingHint( ImageTranscoder.KEY_BACKGROUND_COLOR, // ADDED
MYSELF
Color.white );
This would be one of the bells and whistles not supported by the tiled transcoder.
The TIFF is now just 14000 byte ( suspiciously small...). What does the KEY_WIDTH and KEY_HEIGHT mean ?
This is the size of the image in pixels. So you are generating a 100x100 pixel image with 4 channels of 8 bits (1byte) each:
100*100*4*1 = 40,000 bytes uncompressed I could easily believe 14,000 bytes compressed. Although 100x100 may not be close to big enough for your needs.
By the way, setting the background Color.white is not seen in the result.
Again, million thanks for your help ! Now it's just the final step left.
So
if you could help me with this, I would be REALLY happy :=)
Regards /Gergely
-----Original Message----- From: Thomas DeWeese [mailto:[EMAIL PROTECTED] Sent: Thursday, December 04, 2003 3:41 PM To: Batik Users Subject: Re: How to use "org.apache.batik.ext.awt.image.codec.tiff " ?
Gergely Hajdu wrote:
You are right, I meant baseclass method. I have removed the batik.jar from FOP, but then I just got some other error.
java.lang.NoClassDefFoundError: org/apache/batik/i18n/Localizable at java.lang.ClassLoader.defineClass0(Native Method)
[...]
Exception in thread "main"
The jar's I've included to the classpath is the follow
batik-1.5.zip/batik-1.5/*.jar batik-1.5.zip/batik-1.5/lib/*.jar
Are you sure you have all of these (there are a lot of them). In particular the above mentioned class is from 'lib/batik-util.jar'
batik-1.5.zip/batik-1.5/extensions/*.jar
When I removed the batik.jar ( FOP version ) I could find the
"KEY_INDEXED"
field as well.
I really appreciate your help !
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]