Skip to main content

decoded TIFF printing problem in Java 1.6

4 replies [Last post]
aoganesi
Offline
Joined: 2007-02-23

Dear all,

I am running into a compatability problem between JDK 1.5 and 1.6 while printing a decoded TIFF file

Following is my small test code:

[pre]
public int print(Graphics g, PageFormat pf, int pageIndex)
{
PlanarImage pi = JAIImageLoader.load(new File("out.tiff")); // here I load the TIFF file
Image image = pi.getAsBufferedImage();

Graphics2D g2d = (Graphics2D) g;
g2d.translate(pf.getImageableX(), pf.getImageableY());
g2d.scale(.25, .25);
g2d.drawImage(image, 0, 0, null);
return Printable.PAGE_EXISTS;
}
[/pre]

This code produces a normal quality printout under JDK 1.5
and a very low quality printout under 1.6

It should be noted that if I use the following to load a JPG image it works fine both for 1.5 and 1.6 so the issue appears to be with the way JAI loads this TIFF file.
[pre]
image = new ImageIcon("out.jpg").getImage();
[/pre]
I would greatly appreciate any help with this!
--
Tony.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aoganesi
Offline
Joined: 2007-02-23

Brian,

I am getting a little closer to understanding this issue and I agree: this issue is
entirely printing related. It seems that there is a problem with printing TYPE_BYTE_BINARY images in JDK 1.6

I tried the following work-around and it works

[pre]
BufferedImage bi = new BufferedImage(pi.getWidth(), pi.getHeight(), BufferedImage.TYPE_INT_RGB);
Graphics2D bufImageGraphics = bi.createGraphics();
bufImageGraphics.drawImage(pi.getAsBufferedImage(), 0, 0, null);
[/pre]

fjoin
Offline
Joined: 2010-01-26

Hello
I 've the same problem with compatability between JDK 1.5 and 1.6 while printing a decoded TIFF file. Please can you tell me how you solve it

thanks for reply

Alessandro Ferrucci

This question, in my opinion, is way too vague. What are the issues you are
seeing? Any error messages/stack traces you may be getting and some code
that I/we could read/test out.

Thank you.

On Mon, Feb 1, 2010 at 4:03 AM, wrote:

> Hello
> I 've the same problem with compatability between JDK 1.5 and 1.6 while
> printing a decoded TIFF file. Please can you tell me how you solve it
>
> thanks for reply
> [Message sent by forum member 'fjoin' (florence.join@inist.fr)]
>
> http://forums.java.net/jive/thread.jspa?messageID=384011
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>

--
Signed,
Alessandro Ferrucci
[att1.html]

Brian Burkhalter

Tony,

Printing issues are more appropriately addressed to the Java2D mailing list at
java2d-interest@java.sun.com.

Thanks,

Brian

On Sun, 30 Sep 2007, jai-interest@javadesktop.org wrote:

> Dear all,
>
> I am running into a compatability problem between JDK 1.5 and 1.6 while printing a decoded TIFF file
>
> Following is my small test code:
>
> [pre]
> public int print(Graphics g, PageFormat pf, int pageIndex)
> {
> PlanarImage pi = JAIImageLoader.load(new File("out.tiff")); // here I load the TIFF file
> BufferedImage bi = pi.getAsBufferedImage();
>
> Graphics2D g2d = (Graphics2D) g;
> g2d.translate(pf.getImageableX(), pf.getImageableY());
> g2d.scale(.25, .25);
> g2d.drawImage(image, 0, 0, null);
> return Printable.PAGE_EXISTS;
> }
> [/pre]
>
> This code produces a [b]normal quality[/b] printout under JDK 1.5
> [url]http://[sitedeleted]/tmp/Java_1.5_NORMAL_QUALITY.pdf[/url]
> and a [b]very low quality[/b] printout under 1.6
> [url]http://[sitedeleted]/tmp/Java_1.6_LOW_QUALITY.pdf[/url]
>
> I would greatly appreciate any help with this!
> --
> Tony.
>
> P.S. I produced these PDFs by printing to a PDF printer, printing to a regular printer produces the same results.
> [Message sent by forum member 'aoganesi' (aoganesi)]
>
> http://forums.java.net/jive/thread.jspa?messageID=237746
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.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.dev.java.net
For additional commands, e-mail: interest-help@jai.dev.java.net