-
Notifications
You must be signed in to change notification settings - Fork 678
Closed
Description
@bimusiek
I have added functionality to solve your problem - hopefully in a fairly elegant way:
- Changed
Page.getImageList()andDocument.getPageImageList()to provide the xref of the soft-image mask/SMaskparameter as the second item of each image entry (it was useless before anyway). If this number is positive, then the image itself should be specially treated for creating PNGs. - If
[xref, smask,..., "Im2"]is an entry ofgetPageImageList()and smask is positive, then the following statements should create the originalIm2png:
pix1 = fitz.Pixmap(doc, xref) # pixmap without alpha channel
pix2 = fitz.Pixmap(doc, smask) # this contains the alpha values in its samples
pix3 = fitz.Pixmap(pix1) # copy of pix1 with alpha channel added (new constructor)
pix3.setAlpha(pix2.samples) # fill its alpha values with pix2 samples (new method)
pix3.writePNG("Im2.png") # this should look right now!
Pixmap pix3 should now reflect the original image - and be what you were missing ... let me know your experiences.
Originally posted by @JorjMcKie in #98 (comment)
JorjMcKie
Metadata
Metadata
Assignees
Labels
No labels