Email me the PDF - bill@bearprinting dot com

-Bill

On 1/18/2012 3:55 PM, Craig Edwards wrote:

Thanks for the feedback. There must be something I am missing though... the raw image properties are 1891 x 1335 pixels. Ultimately, it should be drawn into a bounding box on my page which is 378 x 267 points wide (which is a 5:1 pixel-to-point ratio).

I've tried three different approaches:

-Calling image.scaleAbsolute(378, 267)

-Calling image.scalePercent(20)

-Adding the image with no scaling (obviously this doesn't fit all on the page though)

All three approaches don't display the image as it looks when viewed using an image viewer.

Interestingly, I downloaded a PDF Explorer to see if I could see how iText was storing the image. According to the PDF Explorer, it knows it is 1891 x 1335 pixels. The PDF Explorer also provides an image viewer panel where you can look at the images individually... in there, it looks just like it should. It just doesn't display as it should when drawn on the page. I thought it might be my Acrobat Reader (v9) but it also looks washed out on my mac using Preview.

I'm stymied... any other thoughts?

Craig

*From:*Bill Ensley [mailto:[email protected]]
*Sent:* Thursday, 19 January 2012 3:22 AM
*To:* Post all your questions about iText here
*Subject:* Re: [iText-questions] Washed out (transparent) image

Hi Craig,

I'm new to this thread, but have quite a bit of experience here.

The math is simple once you wrap your head around it.

Say you have a 3" x 3" box that you want an image in.

At iText measurements, that box will have a (3"x72pt) x (3"x72pt) or 216pt x 216pt size

If you want a screen resolution image, you would need to place a 216 x 216 pixel image into that box. If you want a print resolution image, you would need a higher resolution image, say 648 x 648 pixels.

So, short answer, if you are looking for a high quality output, you need roughly 3 times your bounding box for you pixels.

Hope this helps,

-Bill Ensley
www.bearprinting.com <http://www.bearprinting.com>

On 1/18/2012 5:59 AM, Leonard Rosenthol wrote:

Downsampling is the term for reducing the resolution of an image.

*From: *Craig Edwards <[email protected] <mailto:[email protected]>> *Reply-To: *Post here <[email protected] <mailto:[email protected]>>
*Date: *Tue, 17 Jan 2012 16:51:29 -0800
*To: *Post here <[email protected] <mailto:[email protected]>>
*Subject: *Re: [iText-questions] Washed out (transparent) image

Umm... sorry for the dumbassery, but how do you mean "downsampling"? I am merely inserting the image with no scaling... I've tried calling various combinations of image.scalePercent() based on the DPI ratio (360 : 72) and image.scaleAbsolute() to set a specific page and it always appears in the way you suggest.

Thanks.

Craig

*From:*Leonard Rosenthol [mailto:[email protected]]
*Sent:* Tuesday, 17 January 2012 3:15 PM
*To:* Post here
*Subject:* Re: [iText-questions] Washed out (transparent) image

The problem isn't color, it appears that you are downsampling the resolution and thus losing image data.

Leonard

*From: *Craig Edwards <[email protected] <mailto:[email protected]>> *Reply-To: *Post here <[email protected] <mailto:[email protected]>>
*Date: *Mon, 16 Jan 2012 15:00:30 -0800
*To: *Post here <[email protected] <mailto:[email protected]>>
*Subject: *Re: [iText-questions] Washed out (transparent) image

Thanks for the reply. I should have mentioned that I had previously tried that and it doesn't appear to make any difference. For reference, I've attached what it looks like when calling with rgbTransparencyBlending=true.

Any other thoughts would be much appreciated.  Thanks a lot.

Craig

*From:*Paulo Soares [mailto:[email protected]]
*Sent:* Monday, 16 January 2012 9:17 PM
*To:* Post all your questions about iText here
*Subject:* Re: [iText-questions] Washed out (transparent) image

Call:

PdfWriter.setRgbTransparencyBlending(true);

Paulo

    ------------------------------------------------------------------------

    *From:*Craig Edwards [mailto:[email protected]]
    *Sent:* Monday, January 16, 2012 3:46 AM
    *To:* [email protected]
    <mailto:[email protected]>
    *Subject:* [iText-questions] Washed out (transparent) image

    Hello fellow iTexters...

    One the images that I am embedding in my PDF appears washed out in
    the final output.  The simplest test case is as follows:

                    Document doc = new Document(PageSize.A4);

                    PdfWriter.getInstance(doc, new
    FileOutputStream(new File("washout.pdf")));

                    doc.open();

                    doc.add(Image.getInstance("checkpoints.png"));

                    doc.close();

    The image appears in the PDF, but the colours are not the same as
    if you just view the image directly.  Note that I normally scale
    the image so that it fits on the page, but I wanted to make the
    test case as simple as possible (you can see the problem both with
    and without scaling).

    I've attached the image and the resulting PDF, and they are also
    downloadable from the following URLs in case they don't make it
    through:

    http://dl.dropbox.com/u/48589982/checkpoints.png

    http://dl.dropbox.com/u/48589982/washout.pdf

    My initial googling suggests that I may need to set the color
    space, but I am not 100% sure if a) that is really the problem and
    b) exactly what the sequence of iText APIs I need to call if it
    is.  Any thoughts/advice would be most welcome.  Thanks a lot.

    Craig



This email message and any accompanying attachments may contain information that is confidential and is subject to legal privilege. If you are not the intended recipient, do not read, use, disseminate, distribute or copy this message or attachments. If you have received this message in error, please notify the sender immediately and delete this message. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of AMP. Before opening any attachments, please check them for viruses and defects.



This email message and any accompanying attachments may contain information that is confidential and is subject to legal privilege. If you are not the intended recipient, do not read, use, disseminate, distribute or copy this message or attachments. If you have received this message in error, please notify the sender immediately and delete this message. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of AMP. Before opening any attachments, please check them for viruses and defects.




------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d




_______________________________________________
iText-questions mailing list
[email protected]  
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book:http://www.itextpdf.com/book/
Please check the keywords list before you ask for 
examples:http://itextpdf.com/themes/keywords.php


This email message and any accompanying attachments may contain information that is confidential and is subject to legal privilege. If you are not the intended recipient, do not read, use, disseminate, distribute or copy this message or attachments. If you have received this message in error, please notify the sender immediately and delete this message. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of AMP. Before opening any attachments, please check them for viruses and defects.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d


_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to