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?".
hout827
Posts: 5 Joined: 2016-12-08T03:37:14-07:00
Authentication code: 1151
Post
by hout827 » 2016-12-08T03:50:18-07:00
I convert a PDF to image by following commands,
Code: Select all
ImageMagick-7.0.1-Q16> convert C:\tog\test.pdf[0] -channel rgba -alpha on c:\tog\Test2.tiff
Code: Select all
ImageMagick-7.0.1-Q16> convert C:\tog\test.pdf[0] -channel rgba -alpha on PNG32:c:\tog\Test2.png
The
png image has a transparent backgound, but the
tiff image has a
white background.
I expect tiff has transparent background too.
Can any one give me some advice?
Thank you in advance!
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-12-08T05:19:21-07:00
What version of Ghostscript are you using? If older than 9.19, I suggest you upgrade it.
Try "-background none" before for the input pdf.
hout827
Posts: 5 Joined: 2016-12-08T03:37:14-07:00
Authentication code: 1151
Post
by hout827 » 2016-12-08T17:39:11-07:00
Thanks for reply.
My Ghostscript is 9.19
And I tested again with '-background none', but the result is same, output tiff has white background still.
Code: Select all
ImageMagick-7.0.1-Q16>convert -background none c:\tog\Test.pdf -channel rgba -alpha on C:\tog\Test.tif
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2016-12-08T18:06:26-07:00
Post your PDF to some place such as dropbox.com so we can test with it and put the URL here.
hout827
Posts: 5 Joined: 2016-12-08T03:37:14-07:00
Authentication code: 1151
Post
by hout827 » 2016-12-08T18:21:33-07:00
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2016-12-08T20:40:45-07:00
Both these commands produce transparent images on my IM 6.9.6.7 Q16 and IM 7.0.3-9 Q16 Mac OSX with
PNG* PNG rw- Portable Network Graphics (libpng 1.6.24)
TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.6)
Code: Select all
convert Test.pdf test.png
convert Test.pdf test.tif
Check your version of libtiff with
hout827
Posts: 5 Joined: 2016-12-08T03:37:14-07:00
Authentication code: 1151
Post
by hout827 » 2016-12-09T00:48:55-07:00
ImageMagick-7.0.1-Q16 in Win10,
PNG* PNG rw- Portable Network Graphics (libpng 1.6.20)
TIFF* TIFF rw+ Tagged Image File Format (LIBTIFF, Version 4.0.6)
Is it a bug of Imagemagick Windows version only?
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2016-12-09T06:17:56-07:00
v7.0.1 was the first of the v7 releases, and not entirely free of bugs, shall we say. I suggest you try a more recent version.
hout827
Posts: 5 Joined: 2016-12-08T03:37:14-07:00
Authentication code: 1151
Post
by hout827 » 2016-12-11T17:39:57-07:00
Thanks for suggestion.
But tested in v7.0.3 (in win10), same issue.
tif has white background, and png's background is transparency.