Feature optional JPEG alpha channel#553
Open
hhelwich wants to merge 12 commits intofoliojs:masterfrom
Open
Conversation
Member
|
Interesting. Why is this specific to JPEG? Can we have a mask option for all image types? |
Author
|
I did it specific for JPEGs because i only needed it there. But i think it's a good idea to have the mask for all image types. |
Author
|
I added the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I have a use case where big PDF files should be generated with many big JPEG files. The JPEG files must not be changed so that the Exif and other meta data stays intact. I found out that this is possible with PDFKit.
I have the additional requirement that the JPEG files can have an alpha channel. I found that PDFKit supports that for PNG files but not for JPEG files. I also found out that it's not difficult to add this feature to PDFKit. I added an extra option
alphawhich can be used to add a grayscale JPEG mask. When the parameter is not used the current behavior is retained. Example usage:I would be glad if you think this feature is of general interest and accept it. If you don't find this feature helpful feel free to decline the pull request. Nevertheless i would be glad to get some feedback. E.g. i increased the PDF version to 1.4 because transparency was not possible in PDF 1.3 but i am not sure if this is without side effects.