Transparency not handled #14

Closed
opened 3 years ago by josch · 0 comments
josch commented 3 years ago
Owner

By josch on 2015-03-15T09:41:51.076Z

Created by: ysangkok

The PDF produced like this:

convert -transparent white logo: logo.jp2
python img2pdf.py logo.jp2 -o logo.pdf

is only viewable in acroread, and not with pdf.js or xpdf or evince or ImageMagick. I suspect it's a colorspace issue again.

Imported comments:

By josch on 2013-10-21 14:10:19 UTC

Well, you can't have transparent images in pdfs. The way transparency is achieved is by using a mask or key on an image without transparency. The masked parts will then be rendered transparently. But if you would try to convert the pdf back to images, then you would end up with an image without transparency and the mask. You would then have to combine those two to get the original image with transparency.

Img2pdf was written to allow storing images in a pdf container without any loss of quality. You could now argue that since there is a way to achieve transparency in pdf, it should allow to do the same for transparent images even if that means to do some conversion of the input image.

What is your use case? Would it be enough if the transparency would be replaced by a solid color? I'm afraid that extracting a working mask would be quite some effort...


By josch on 2017-01-21T07:53:11.083Z


Closing because submitter doesn't provide more detail about why transparency support would be useful.


By josch on 2017-01-21T07:53:11.374Z


Status changed to closed

*By josch on 2015-03-15T09:41:51.076Z* *Created by: ysangkok* The PDF produced like this: convert -transparent white logo: logo.jp2 python img2pdf.py logo.jp2 -o logo.pdf is only viewable in acroread, and not with pdf.js or xpdf or evince or ImageMagick. I suspect it's a colorspace issue again. **Imported comments:** *By josch on 2013-10-21 14:10:19 UTC* Well, you can't have transparent images in pdfs. The way transparency is achieved is by using a mask or key on an image without transparency. The masked parts will then be rendered transparently. But if you would try to convert the pdf back to images, then you would end up with an image without transparency and the mask. You would then have to combine those two to get the original image with transparency. Img2pdf was written to allow storing images in a pdf container without any loss of quality. You could now argue that since there is a way to achieve transparency in pdf, it should allow to do the same for transparent images even if that means to do some conversion of the input image. What is your use case? Would it be enough if the transparency would be replaced by a solid color? I'm afraid that extracting a working mask would be quite some effort... --- *By josch on 2017-01-21T07:53:11.083Z* --- Closing because submitter doesn't provide more detail about why transparency support would be useful. --- *By josch on 2017-01-21T07:53:11.374Z* --- Status changed to closed
josch closed this issue 3 years ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: josch/img2pdf#14
Loading…
There is no content yet.