Reputation: 4978
I am having some trouble with ImageMagick.
I have installed GhostScript v9.00 and ImageMagick-6.6.7-1-Q16 on Windows 7 - 32Bit
When I run the following command in cmd
convert D:\test\sample.pdf D:\test\pages\page.jpg
only the first page of the pdf is converted to pdf. I have also tried the following command
convert D:\test\sample.pdf D:\test\pages\page-%d.jpg
This creates the first jpg as page-0.jpg but the other are not created. I would really appreciated if someone can shed some light on this. Thanks.
UPDATE:
I have ran the command using -debug "All"
one of the many lines out put says:
2011-01-26T22:41:49+01:00 0:00.727 0.109u 6.6.7 Configure Magick[5800]: nt-base.c/NTGhostscriptGetString/1008/Configure
registry: "HKEY_CURRENT_USER\SOFTWARE\GPL Ghostscript\9.00\GS_DLL" (failed)
Could it maybe have something to do with GhostScript after all?
Upvotes: 27
Views: 21531
Reputation: 600
I ran into similar problem with GhostScript. This can be solver with using %03d
iterator in the output file name. Here is example:
gs -r300 -dNOPAUSE -dBATCH -sDEVICE#pngalpha -sOutputFile=output-%03d.png input.pdf
Here is the reference with detailed information: https://ghostscript.com/doc/current/Devices.htm
Upvotes: 0
Reputation: 4603
By the way if you need to convert first and second pages then provide in array comma separated values
convert D:\test\sample.pdf[0,1] D:\test\pages\page.jpg
Resulting JPEG files will be named:
page-0.jpg
page-1.jpg
You can also do
convert D:\test\sample.pdf[10,15,20-22,50] D:\test\pages\page.jpg
Resulting JPEG files will be named:
page-10.jpg
page-15.jpg
page-20.jpg
page-21.jpg
page-22.jpg
page-50.jpg
May be it will help to someone.
Upvotes: 18
Reputation: 107
I found this solution which convert all pages in the pdf to a single jpg image:
montage input.pdf -mode Concatenate -tile 1x output.jpg
montage is included in ImageMagick.
Tested on ImageMagick 6.7.7-10 on Ubuntu 13.04.
Upvotes: 5
Reputation: 69
According to the site admin at the ImageMagick forum:
ImageMagick uses the pngalpha device when it finds an Adobe Illustrator PDF. Many of these are a single page. Ideally, Ghostscript would support a device that allows multiple PDF pages with transparency but it doesn't...
Easy fix. Edit delegates.xml and change pngalpha to pnmraw.
This worked for me. I don't know if it introduces any other problems however.
See this post from their forums.
Upvotes: 6
Reputation: 360632
You can specify which page to convert by putting a number in [] after the filename:
convert D:\test\sample.pdf[7] D:\test\pages\page-7.jpg
It should have, however, converted all pages to individual images with your command.
Upvotes: 42