jpg to pdf - with original size

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?".
KingCanadian
Posts: 3
Joined: 2012-05-26T04:19:09-07:00
Authentication code: 13

jpg to pdf - with original size

Postby KingCanadian » 2012-05-26T04:33:54-07:00

Hello folks,

im trying to convert a jpg (scanned with 150 dpi) to a pdf with a4 papersize.
But the scan shoud appear in original size.

At first i tryed the following:

Code: Select all

convert test.jpg -page a4 out.pdf

But the image spans the complete width of the pdf.

Then i read the forum and googled:
the -density should help

So i tryed:

Code: Select all

convert test.jpg -page a4 -density 150 out.pdf


But nothing changes - the image is still not original size.
What am i doing wrong?

Regards
Juergen

indiego
Posts: 75
Joined: 2010-10-16T06:35:10-07:00
Authentication code: 8675308

Re: jpg to pdf - with original size

Postby indiego » 2012-05-29T02:48:18-07:00

I get the same results here. Also tried a two step conversion, but '-page a4' always blows up the graphic to canvas size.
You should give 'sam2p' a try, which is mentioned here [search for 'Image to PDF converters...']

http://www.imagemagick.org/Usage/formats/#vector

I guess 'sam2p_pdf_scale.pl' simply changes the size of the pdf boxes (no size increase, as with the bigger A4 canvas).

Untested (running out of time).

KingCanadian
Posts: 3
Joined: 2012-05-26T04:19:09-07:00
Authentication code: 13

Re: jpg to pdf - with original size

Postby KingCanadian » 2012-05-31T04:03:18-07:00

Thank you for your reply,
but unfortunately sam2p too makes a pdf not with the original size and not in A4.

So i am still searching for a solution how can i get a jpg in original size to a A4pdf.

User avatar
fmw42
Posts: 15130
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA
Contact:

Re: jpg to pdf - with original size

Postby fmw42 » 2012-05-31T09:49:03-07:00

try resizing (-resize) to the size specified by the A4 page size (595x842). see http://www.imagemagick.org/script/comma ... s.php#page

KingCanadian
Posts: 3
Joined: 2012-05-26T04:19:09-07:00
Authentication code: 13

Re: jpg to pdf - with original size

Postby KingCanadian » 2012-05-31T21:05:49-07:00

Perhaps i should explain again:

My scanned jpg is in original 15x10cm - i want that to be shown and printed in the middle or top of a A4 PDF. The rest of the page should be white.

indiego
Posts: 75
Joined: 2010-10-16T06:35:10-07:00
Authentication code: 8675308

Re: jpg to pdf - with original size

Postby indiego » 2012-06-02T02:18:53-07:00

This works, but there are better ways to create such a PDF (e.g. ConTeXt).

Code: Select all

convert -density 150 -size 1239x1754 xc:white -density 150 test.jpg -gravity center -composite test.pdf

size: (210mm/25,4mm*150) x (297mm/25,4mm*150)

jobjol
Posts: 2
Joined: 2012-07-27T02:42:30-07:00
Authentication code: 15

Re: jpg to pdf - with original size

Postby jobjol » 2012-08-12T09:50:55-07:00

Try this command.
ImageMagick doesn't work well alone, but in tandem with other apps it will do the trick.
Check the output and functionality of the command @ http://convertjpgpdf.net

Code: Select all

convert -scale ".$HEIGHT."x".$WIDTH." -border ".$MARGIN."x".$MARGIN." -bordercolor white $inputfile $outputfile

find . -maxdepth 1 -iname 'page*.jpg' -exec sam2p '{}' '{}'.pdf \;"
sam2p_pdf_scale ".$PAGE_WIDTH." ".$PAGE_HEIGHT." page".$key.".jpg.pdf
pdfjoin page*.pdf --outfile out.pdf


Return to “Users”

Who is online

Users browsing this forum: No registered users and 8 guests