I am using imagemagick on a linux box running centos. I have png images that I am converting to pdf files.
An example size of a png in pixels would be 943x3331 (widthxheight) . When I convert this to a pdf it always keeps the pdf on one page so I am left with the image as a thin stripe down the middle of a pdf. I would like to be able to convert the pdf so it fits the png to the width of the page and goes down as many pages as needed for the height. Is this possible?
png to pdf always fits height to 1 page
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: png to pdf always fits height to 1 page
This is possible. You would have to -crop the image into tiles before saving the image as a pdf.
Re: png to pdf always fits height to 1 page
Just to check are you saying that I need to crop the png into sizes that will each fit a page and then convert all of these into a pdf?
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: png to pdf always fits height to 1 page
Break the input png into page sized tiles using -crop, then output to pdf. Something like:
There are many ways to crop and to position the tiles on the pages.
Code: Select all
convert -size 943x3331 gradient: in.png
convert in.png -crop 950x1200 +repage out.pdf
Re: png to pdf always fits height to 1 page
but there is no setting that will convert a png to a pdf of more than one page?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: png to pdf always fits height to 1 page
He is suggesting that you crop the image into horizontal strips of height equal to one proper page. Then output the cropped sections to separate PDF pages.GreenKoopa wrote:convert in.png -crop 950x1200 +repage out.pdf
see
http://www.imagemagick.org/Usage/crop/#crop_tile
http://www.imagemagick.org/Usage/crop/#crop_equal
- GreenKoopa
- Posts: 457
- Joined: 2010-11-04T17:24:08-07:00
- Authentication code: 8675308
Re: png to pdf always fits height to 1 page
Not that I know of. ImageMagick is not specifically a pdf or page layout tool. My example created a png of the size you gave, then created a pdf with that image split over 3 pages. It's not a setting, but it accomplished the same output with little complexity. Try that second line on your image and let us know what specifically more you want it to do.noelegdip wrote:but there is no setting that will convert a png to a pdf of more than one page?
Re: png to pdf always fits height to 1 page
thanks for all your help in this and it worked. i used
convert test.png -crop 943x1360 +repage sample.pdf
I have a perfect 5 page pdf and am very happy. pat on the back for you and all that kind of thing.
convert test.png -crop 943x1360 +repage sample.pdf
I have a perfect 5 page pdf and am very happy. pat on the back for you and all that kind of thing.