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?".

jpg to pdf - with original size

Postby KingCanadian » 2012-05-26T04:33:54+00: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
KingCanadian
 
Posts: 3
Joined: 2012-05-26T04:19:09+00:00

Re: jpg to pdf - with original size

Postby indiego » 2012-05-29T02:48:18+00: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).
indiego
 
Posts: 75
Joined: 2010-10-16T06:35:10+00:00

Re: jpg to pdf - with original size

Postby KingCanadian » 2012-05-31T04:03:18+00: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.
KingCanadian
 
Posts: 3
Joined: 2012-05-26T04:19:09+00:00

Re: jpg to pdf - with original size

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

try resizing (-resize) to the size specified by the A4 page size (595x842). see http://www.imagemagick.org/script/comma ... s.php#page
User avatar
fmw42
 
Posts: 14813
Joined: 2007-07-02T17:14:51+00:00
Location: Sunnyvale, California, USA

Re: jpg to pdf - with original size

Postby KingCanadian » 2012-05-31T21:05:49+00: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.
KingCanadian
 
Posts: 3
Joined: 2012-05-26T04:19:09+00:00

Re: jpg to pdf - with original size

Postby indiego » 2012-06-02T02:18:53+00: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)
indiego
 
Posts: 75
Joined: 2010-10-16T06:35:10+00:00

Re: jpg to pdf - with original size

Postby jobjol » 2012-08-12T09:50:55+00: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
jobjol
 
Posts: 2
Joined: 2012-07-27T02:42:30+00:00


Return to Users

Who is online

Users browsing this forum: Google [Bot] and 8 guests