Convert PDF to JPG black backgroun

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
quetzco
Posts: 2
Joined: 2016-09-11T10:37:58-07:00
Authentication code: 1151

Convert PDF to JPG black backgroun

Post by quetzco »

Hi,
I'm driving crazy with a very simple conversion.
I need to convert some PDF drawings to JPG in order to embed them into a Crystal Report.
Some drawings are in A3 format so I need to resize them to A4.
My configuration is:
- Windows 10 Pro
- ImageMagick-7.0.3-0-Q16-x64
- gs919w64
I don't need to use too much properties, so my command line is simple like this:
- convert "C:/Temp/B02798800_B.PDF" -resize 842x595^> "C:/Temp/B02798800_B.JPG"
Using exact pixel dimensions or percentage doesn't change the final result: a total black background.
If I use -page A4 property it works.
I'd prefer to use -resize because with the ^> extension, it could be avoided an unnecessary resizing (drawing smaller thn A4 format).
It seems that the problem is related only to the -resize property.

Thanks in advance for any help.

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

Re: Convert PDF to JPG black backgroun

Post by snibgo »

Your PDF probably has a transparent backgound. JPG can't store transparency. What colour do you want the background to be? Perhaps white:

Code: Select all

convert "C:/Temp/B02798800_B.PDF" -background White -layers flatten -resize 842x595^> "C:/Temp/B02798800_B.JPG"
snibgo's IM pages: im.snibgo.com
quetzco
Posts: 2
Joined: 2016-09-11T10:37:58-07:00
Authentication code: 1151

Re: Convert PDF to JPG black backgroun

Post by quetzco »

Great!
I've tried it immediately and it works.
Thank you

Antonio
Post Reply