conversion problem of PDF to PNG with alpha channel

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
masaharu96
Posts: 2
Joined: 2014-11-17T06:04:02-07:00
Authentication code: 6789

conversion problem of PDF to PNG with alpha channel

Post by masaharu96 »

Hello,

I have a problem in which IM or GhostScript can't convert PDF file with alpha channel transparency to PNG format.
The PDF file was made with Adobe Illustrator's drop shadow. The conversion result PNG file does not have transparent background, but has white box background. It seems that IM or GS are not aware the PDF file has alpha channel tranparency.

I tried to find solution on the Web but I have not find any.

Does anyone know how to solve this problem or any hints for this ?

Thanks,
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: conversion problem of PDF to PNG with alpha channel

Post by snibgo »

What versions of IM and Ghostscript? If they are old, an upgrade might cure it.

Do you want to convert each PDF page into a raster image, or do you want to extract raster images from the PDF? IM (using Ghostscript) is a good tool for the first, but pdfimages is a good tool for the second.
snibgo's IM pages: im.snibgo.com
masaharu96
Posts: 2
Joined: 2014-11-17T06:04:02-07:00
Authentication code: 6789

Re: conversion problem of PDF to PNG with alpha channel

Post by masaharu96 »

I'm using IM ImageMagick-6.7.7-Q16 & gs9.07. What I want to do is to convert one PDF page into one PNG file.
I'm using Windows OS . Tools on Mac or Linux won't help me.

I have found similar discussions on PDF alpha channel problme in this site,
but it seems that any of them didn't show good solutions to me.

I'm still waiting for the information on this.

Thanks,
pipitas
Posts: 168
Joined: 2012-07-15T14:06:46-07:00
Authentication code: 15

Re: conversion problem of PDF to PNG with alpha channel

Post by pipitas »

masaharu96 wrote: I have a problem in which IM or GhostScript can't convert PDF file with alpha channel transparency to PNG format.
The PDF file was made with Adobe Illustrator's drop shadow. The conversion result PNG file does not have transparent background, but has white box background. It seems that IM or GS are not aware the PDF file has alpha channel tranparency.
What is the output of

Code: Select all

identify.exe -version
?

Which version of Ghostscript is installed on your system? Is it 32-bit or 64-bit? Post the output of

Code: Select all

gswin32c.exe --version
gswin64c.exe --version
and of

Code: Select all

gswin32c.exe -h | findstr png
gswin64c.exe -h | findstr png
ImageMagick does not process PDF files itself. It calls Ghostscript as its 'delegate'. Usually then, Ghostscript is called with an `-sDEVICE=pngalpha` option. And that device DOES support the alpha channel! (And if the PDF->PNG conversion with `convert` does work at all, then your Windows system does also have Ghostscript installed, even if you are not aware of it...)

So my commands above are designed to find out if your system has a modern Ghostscript with a `pngalpha` output option.

You can observe the exact Ghostscript command line invoked by ImageMagick by adding `convert -verbose` to your original `convert` command...

The only other possibility I can currently think of: your PDF does not truely have a transparent background, but an opaque white one.

Can you provide a link to your PDF?
Post Reply