Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to remove transparency when converting PDF to TIFF #468

bmoscon opened this issue Mar 10, 2020 · 2 comments

Unable to remove transparency when converting PDF to TIFF #468

bmoscon opened this issue Mar 10, 2020 · 2 comments


Copy link

@bmoscon bmoscon commented Mar 10, 2020

Using the following code:

from wand.image import Image, Color

with Image(filename='5-page-pdf.pdf', resolution=200, colorspace='gray', background=Color('white')) as img:
    img.type = "grayscale"
    img.format = "tiff"
    img.compression = "lzw"
    img.alpha_channel = 'off'"test.tiff")

I get a TIFF that has transparency enabled on pages 2-4. I've tried other things to remove the alpha channel ('remove', using a context manager on the sequence to remove it on the individual SingleImages, etc), but nothing seems to work. I've pasted links to the original PDF and the TIFF this produces.

I should note that imageMagick has no issues when I use the following command:

convert -density 200 5-page-pdf.pdf -type grayscale -compress lzw test.tiff

So I'm not sure if this is a bug in wand or something else.

Copy link

@emg36 emg36 commented Mar 11, 2020

I have come across a similar bug.

On MacOS to remove transparency from .pngs I need to set img.alpha_channel = 'remove' and in a linux environment I need to set img.alpha_channel = False.

Copy link

@emcconville emcconville commented Mar 11, 2020

Thanks for opening an issue here, as well as posting on stackoverflow. It really helps folks search for similar issues.

Additional test case posted by Fred.

for frame in img.sequence:
    img.background_color = "white"
    img.alpha_channel = "remove"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants