Problem converting transparent PDF to PNG

View: New views
8 Messages — Rating Filter:   Alert me  

Problem converting transparent PDF to PNG

by Brian Dunning :: Rate this Message:

| View Threaded | Show Only this Message

Hello all -

I'm having the problem (which Professor Google tells me is common) converting PDF to PNG. The PDFs are white text on a transparent background, and when I convert them I only get a solid white document. This is on Red Hat 4.x, and due to that limitation, Rackspace is only able to get GS 7.07 installed.

gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -dEPSCrop -sOutputFile=/path/to/output.png /path/to/input.pdf

I've tried all the variations on the above I can think of. Any suggestions?

- Brian
_______________________________________________
gs-devel mailing list
gs-devel@...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

Re: Problem converting transparent PDF to PNG

by Chris Liddell :: Rate this Message:

| View Threaded | Show Only this Message

On 17/06/11 15:07, Brian Dunning wrote:
> Hello all -
>
> I'm having the problem (which Professor Google tells me is common) converting PDF to PNG. The PDFs are white text on a transparent background, and when I convert them I only get a solid white document. This is on Red Hat 4.x, and due to that limitation, Rackspace is only able to get GS 7.07 installed.
>
> gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -dEPSCrop -sOutputFile=/path/to/output.png /path/to/input.pdf
>
> I've tried all the variations on the above I can think of. Any suggestions?

Do you mean that the PDFs use the PDF transparency capabilities for the
background? Or that the background is just "not marked"?

Chris
_______________________________________________
gs-devel mailing list
gs-devel@...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

Re: Problem converting transparent PDF to PNG

by Brian Dunning :: Rate this Message:

| View Threaded | Show Only this Message

Interesting question, I'm not sure. I start with a transparent, blank doc saved as a Photoshop PDF, and then I use FPDI/FPDF in PHP to add the white text. That's the doc.

On Jun 17, 2011, at 7:25 AM, Chris Liddell wrote:

> Do you mean that the PDFs use the PDF transparency capabilities for the
> background? Or that the background is just "not marked"?
_______________________________________________
gs-devel mailing list
gs-devel@...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

Re: Problem converting transparent PDF to PNG

by john Culleton-3 :: Rate this Message:

| View Threaded | Show Only this Message

On Fri, 17 Jun 2011 07:07:26 -0700
Brian Dunning <brian@...> wrote:

> Hello all -
>
> I'm having the problem (which Professor Google tells me is common)
> converting PDF to PNG. The PDFs are white text on a transparent
> background, and when I convert them I only get a solid white
> document. This is on Red Hat 4.x, and due to that limitation,
> Rackspace is only able to get GS 7.07 installed.
>
> gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -dEPSCrop
> -sOutputFile=/path/to/output.png /path/to/input.pdf
>
> I've tried all the variations on the above I can think of. Any
> suggestions?
>
> - Brian
> _______________________________________________
> gs-devel mailing list
> gs-devel@...
> http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel
>
Not sure that PNG can handle transparency.

John Culleton
_______________________________________________
gs-devel mailing list
gs-devel@...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

Parent Message unknown Re: Problem converting transparent PDF to PNG

by Brian Dunning :: Rate this Message:

| View Threaded | Show Only this Message

Thanks Ray. How would I do what you suggest? Can that be added to my command? I'm executing this from within PHP as an exec().


On Jun 17, 2011, at 8:43 AM, Ray Johnston wrote:

Brian,

Your pdf probably has transparency. The pngalpha device needs to be extended to
add a 'put_image' proc that is able to handle the alpha plane from the pdf14 transparency
compositor. The default pushes an image after flattening the alpha and blending with
the background color, thus the white page.

This could also be addressed if the default put_image wrote a ImageType 3 which has
a mask plane as well as the page image so that the pngalpha device would not see
the masked pixels written, but the put_image is MUCH more efficient.

Regards,
Ray Johnston


On 6/17/2011 7:07 AM, Brian Dunning wrote:
Hello all -

I'm having the problem (which Professor Google tells me is common) converting PDF to PNG. The PDFs are white text on a transparent background, and when I convert them I only get a solid white document. This is on Red Hat 4.x, and due to that limitation, Rackspace is only able to get GS 7.07 installed.

gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -dEPSCrop -sOutputFile=/path/to/output.png /path/to/input.pdf

I've tried all the variations on the above I can think of. Any suggestions?

- Brian
_______________________________________________
gs-devel mailing list
gs-devel@...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel




_______________________________________________
gs-devel mailing list
gs-devel@...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

Re: Problem converting transparent PDF to PNG

by john Culleton-3 :: Rate this Message:

| View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

On Friday, June 17, 2011 10:25:51 am Chris Liddell wrote:

> On 17/06/11 15:07, Brian Dunning wrote:

> > Hello all -

> >

> > I'm having the problem (which Professor Google tells me is common)

> > converting PDF to PNG. The PDFs are white text on a transparent

> > background, and when I convert them I only get a solid white document.

> > This is on Red Hat 4.x, and due to that limitation, Rackspace is only

> > able to get GS 7.07 installed.

> >

> > gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -dEPSCrop

> > -sOutputFile=/path/to/output.png /path/to/input.pdf

> >

> > I've tried all the variations on the above I can think of. Any

> > suggestions?

>

> Do you mean that the PDFs use the PDF transparency capabilities for the

> background? Or that the background is just "not marked"?

>

> Chris

> _______________________________________________

> gs-devel mailing list

> gs-devel@...

> http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

I am not sure that png supports transparency.

--

John Culleton

"Death Wore Black" Police procedural: http://www.deathworeblack.com/

"Create Book Covers with Scribus"

http://booklocker.com/books/4055.html


_______________________________________________
gs-devel mailing list
gs-devel@...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

Re: Problem converting transparent PDF to PNG

by Bugzilla from martin@oneiros.de :: Rate this Message:

| View Threaded | Show Only this Message

2011/6/28 John Culleton <john@...>:
> I am not sure that png supports transparency.

It does.

https://secure.wikimedia.org/wikipedia/en/wiki/Portable_Network_Graphics#Transparency_of_image

Best
   Martin

PS: http://www.penmachine.com/techie/emailtrouble_2003-07.html
_______________________________________________
gs-devel mailing list
gs-devel@...
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel

Re: Problem converting transparent PDF to PNG

by jfplante :: Rate this Message:

| View Threaded | Show Only this Message

Brian,

Did you get to solve the problem? I seem to run into the same problem...

Jf

Brian Dunning wrote:
Thanks Ray. How would I do what you suggest? Can that be added to my command? I'm executing this from within PHP as an exec().


On Jun 17, 2011, at 8:43 AM, Ray Johnston wrote:

> Brian,
>
> Your pdf probably has transparency. The pngalpha device needs to be extended to
> add a 'put_image' proc that is able to handle the alpha plane from the pdf14 transparency
> compositor. The default pushes an image after flattening the alpha and blending with
> the background color, thus the white page.
>
> This could also be addressed if the default put_image wrote a ImageType 3 which has
> a mask plane as well as the page image so that the pngalpha device would not see
> the masked pixels written, but the put_image is MUCH more efficient.
>
> Regards,
> Ray Johnston
>
> On 6/17/2011 7:07 AM, Brian Dunning wrote:
>>
>> Hello all -
>>
>> I'm having the problem (which Professor Google tells me is common) converting PDF to PNG. The PDFs are white text on a transparent background, and when I convert them I only get a solid white document. This is on Red Hat 4.x, and due to that limitation, Rackspace is only able to get GS 7.07 installed.
>>
>> gs -q -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300 -dEPSCrop -sOutputFile=/path/to/output.png /path/to/input.pdf
>>
>> I've tried all the variations on the above I can think of. Any suggestions?
>>
>> - Brian
>> _______________________________________________
>> gs-devel mailing list
>> gs-devel@ghostscript.com
>> http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel
>>
>


_______________________________________________
gs-devel mailing list
gs-devel@ghostscript.com
http://ghostscript.com/cgi-bin/mailman/listinfo/gs-devel