Hello,
I'm trying to make a tool that converts a pdf to a gif.
When I try this with a jpg, a get multiple jpgs in return.
I would like to get the same result when converting to a gif.
Next to this problem I want to resize the images between a max width and height.
When resizing an image with dimensions 400*300 to a max size of 200*100, I get 133*100.
I would like to have a rsesult image that measures 200*100, but where the picture is positioned 33px from the left (centered).
The same option is wanted in a vertical way as well.
Is all this doable in one line or do I have to redraw the image for each page myself (and center it)?
Thx in advance for any help.
Regards,
Rule
pdf to multiple gifs instead of animated gif?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: pdf to multiple gifs instead of animated gif?
It may depend upon if your PDF has multiple pages, then you might get a multiframe image as a result or multiple images if the format does not support multiframes. GIF and TIFF support mutiframe images, but I don't think JPG does. Therefore you probably get multiple images as a result. Are you trying to force the gifs to be multiple images rather than multiframe? If so, try
convert image.pdf image-%02d.gif
Please post your command line for resizing for us to see what you are doing. Also what do you want for the background if you want the resized image positioned in some way. Or do you just want a border around it so that the image is centered with a 33 px border.
Please clarify all of this. It is not clear what you are trying to do.
However, most likely it should be possible to put it all in one command line.
convert image.pdf image-%02d.gif
Please post your command line for resizing for us to see what you are doing. Also what do you want for the background if you want the resized image positioned in some way. Or do you just want a border around it so that the image is centered with a 33 px border.
Please clarify all of this. It is not clear what you are trying to do.
However, most likely it should be possible to put it all in one command line.
Re: pdf to multiple gifs instead of animated gif?
Hello,
Currently I'm not forcing to convert the pdf to multiple gifs.
This because I don't know how to do it.
About the alignment of the content of the images...
Since they are gifs, I would like to have a transparent background next to the image.
The 33px is just an example, for any format the real image data has to be centered in the resulting image.
This is the command line: convert -resize 200*300 path/pdf.pdf path/gif.gif
Friendly regards,
Roel
Currently I'm not forcing to convert the pdf to multiple gifs.
This because I don't know how to do it.
About the alignment of the content of the images...
Since they are gifs, I would like to have a transparent background next to the image.
The 33px is just an example, for any format the real image data has to be centered in the resulting image.
This is the command line: convert -resize 200*300 path/pdf.pdf path/gif.gif
Friendly regards,
Roel
Re: pdf to multiple gifs instead of animated gif?
I guess maybe:
Or perhaps -page or -geometry. Have a look at the docs here: http://www.imagemagick.com/www/command- ... tions.html.
Best regards, Klaus
Code: Select all
convert -resize 200*300 -border 200x300 path/pdf.pdf path/gif.gif
Best regards, Klaus
Re: pdf to multiple gifs instead of animated gif?
Hello,
I'm glad to inform that the trick with %02d works.
However, everytime I get 2 digits.
Is there a way to have 1,2,..,10,11,12,...,101,...
The question about the image alignment still stands...
Friendly regards,
Roel
I'm glad to inform that the trick with %02d works.
However, everytime I get 2 digits.
Is there a way to have 1,2,..,10,11,12,...,101,...
The question about the image alignment still stands...
Friendly regards,
Roel
Re: pdf to multiple gifs instead of animated gif?
Nobody has a solution for the image alignment?
I've checked page and geometry, but I believe they need real pixels (wich can be different per image)...
Regards,
Roel
I've checked page and geometry, but I believe they need real pixels (wich can be different per image)...
Regards,
Roel
Re: pdf to multiple gifs instead of animated gif?
I suspect we've got a case of standard printf behavior here. Try %d for for numbers without any padding. %2d will pad to two digits, while the above mentioned %02 pad to two digits with leading zeroes.Rule wrote:I'm glad to inform that the trick with %02d works.
However, everytime I get 2 digits.
Is there a way to have 1,2,..,10,11,12,...,101,...
- Klaus
Re: pdf to multiple gifs instead of animated gif?
Hello Klaws,Klaws wrote:I suspect we've got a case of standard printf behavior here. Try %d for for numbers without any padding. %2d will pad to two digits, while the above mentioned %02 pad to two digits with leading zeroes.Rule wrote:I'm glad to inform that the trick with %02d works.
However, everytime I get 2 digits.
Is there a way to have 1,2,..,10,11,12,...,101,...
- Klaus
Thanks for your reaction. I allready assumed that the 02 meant 2 digits, but since I didn't know the real syntax, I thought I'd ask for it.
Again thanks alot
PS Also thank you fmw42 for giving this example...
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: pdf to multiple gifs instead of animated gif?
convert image.pdf -resize 200x300 -alpha on -channel RGBA -bordercolor none -border 33x33 image.gif
This should resize to 200x300, turn on the alpha channel and make a 33 px transparent border around the image. But I have not tested it to be sure it works.
This should resize to 200x300, turn on the alpha channel and make a 33 px transparent border around the image. But I have not tested it to be sure it works.
Re: pdf to multiple gifs instead of animated gif?
Thx for all help!
I solved the problem with -repage 400*400+0+50...
Friendly regards,
Roel
I solved the problem with -repage 400*400+0+50...
Friendly regards,
Roel