Sudhakar
Sudhakar

Reputation: 19

Using ImageMagick Convert PDF to Image and the converted Image name should start from 1 instead of 0

When I convert PDF to JPG using below command

#] convert -geometry 1024x768 -density 200 -colorspace RGB /opt/test.pdf +adjoin /tmp/check/test_%0d.jpg

I'm getting the output as
test_0.jpg
test_1.jpg
test_2.jpg

how can I have the sequence to be as below:-
test_1.jpg
test_2.jpg
test_3.jpg

Upvotes: 2

Views: 3146

Answers (1)

2potatocakes
2potatocakes

Reputation: 2260

If you're using ImageMagick 6.2 or greater you can use the 'scene' parameter to start at a particular number.. so something like:

convert -geometry 1024x768 -density 200 -colorspace RGB /opt/test.pdf +adjoin -scene 1 /tmp/check/test_%0d.jpg

should output the file sequence you want starting at 1.

+adjoin -scene 342 image_%03d.gif

would output image_342.gif, image_343.gif etc

Hope that helps

Upvotes: 4

Related Questions