About us | News | Contact
iText ® Licenses Support   
You are here: Home > Forums > iText in Action — Second Edition > Part 4: Under the hood > Chapter 15: Page content and structure
User login
  • Create new account
  • Request new password

Extracted images are very dark

Submitted by Massimo Lovato on Tue, 01/31/2012 - 23:58

Good evening.
I tried to implement listing 15.30 and 15.31 of the book, and images were extracted from a pdf as .jpg files. The problem is that extracted images are very very dark compared to the original pdf. Is there anything I can do to solve this problem?
Thank you
Massimo

‹ Mapping high- and low-level info in a PDF Getting the target URL for an external link from PdfAnnotation.PdfImportedLink ›
  • Login or register to post comments

How are the images stored in the PDF?

Submitted by Bruno Lowagie on Wed, 02/01/2012 - 08:47.

When you add a JPEG to a PDF document, the bytes of the image are copied literally into the PDF file. That's different from PNG, BMP,... images where the bytes are transformed using another image compression type. For images with transparent parts, one original image can be present as two different images inside the PDF: one opaque image and another image that acts as its mask.
If your image was originally a JPEG, then the extracted JPEG is identical to the original one, BUT: it's possible that the images was masked (see the part about soft masks in chapter 10).
Another possibility is that there's transparency involved. Different blending modes will have different results (for instance: making the image darker or lighter).

There's really plenty of things that can be going on in your PDF. Without seeing the actual PDF, it's very hard to tell you what makes the difference between the images in the PDF and the extracted image.

  • Login or register to post comments

Thank you

Submitted by Massimo Lovato on Wed, 02/01/2012 - 15:30.

Ok, thank you very much for your quick reply.
I tried with different kinds of pdf and sometimes the result was as expected.
So thank you for your clarification.
If you want to take a look to the "problematic" pdf, it's at this link:
http://www.fomet.it/file-fomet/pubblicita/FOMET_PAG.STORIA.pdf
But don't worry at all about it, because it's just my curiosity.
Massimo

  • Login or register to post comments
Content © 2010 1T3XT BVBA