Linux imagemagick based solution to print image as full page

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?".
Post Reply
xpt
Posts: 59
Joined: 2010-10-06T20:18:24-07:00
Authentication code: 8675308

Linux imagemagick based solution to print image as full page

Post by xpt »

Hi,

As titled, I'm looking for a imagemagick based solution to print an arbitrary image on a full legal/A4 page under Linux, and better just the image, no any headers and footers.

I've searched it myself, but bits and pieces of info here and there on the web about DPI, density, etc just doesn't paint a whole picture for me. Please help (better cover both horizontal and portrait cases).

Thanks.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Linux imagemagick based solution to print image as full

Post by fmw42 »

I have never used this, but see -page <media> at http://www.imagemagick.org/script/comma ... s.php#page
xpt
Posts: 59
Joined: 2010-10-06T20:18:24-07:00
Authentication code: 8675308

Re: Linux imagemagick based solution to print image as full

Post by xpt »

fmw42 wrote: see -page <media>
Thanks fmw42,

Hmm, -page <media> will "set the size and location of an image on the larger virtual canvas", and "is used in concert with -density". I believe that DPI is also a concern as well.

So, say my picture is of size 1600x1200, to enable printing to Letter size full page (which is 792x612, landscape), what shall I do? Further, how can I print it? ie, can the converted result be directly printed with the display command onto Letter size page in full? Or, to convert to ps/pdf files, I read that there has been problems with the bonding box or something, is it now fixed?

thanks
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Linux imagemagick based solution to print image as full

Post by fmw42 »

sorry I really don't know much about printing.

density and DPI are the same. IM use -density to set the dpi. IM does not do any printing to my knowledge. You have to set the density appropriately or use -page <media> to do it (perhaps, I don't know). Then send the image to your printer using your print command on your computer or other imaging application.

Density is dots (pixels) per inch. So you need to know how big your page is in inches. The divide the pixels in the image by the inches in both width and height.

So say a legal page is 14 x 11 (landscape) and your image is 1600 x 1200. Then your would set your density to 1600/14 x 1200/11 (whatever those division amount to). So

convert image -density 114x109 -units pixels-per-inch resultimage

unless your have a vector image i.e pdf/postscript image, then

convert -density 114x109 -units pixels-per-inch image resultimage

see http://www.imagemagick.org/Usage/formats/#ps
xpt
Posts: 59
Joined: 2010-10-06T20:18:24-07:00
Authentication code: 8675308

Re: Linux imagemagick based solution to print image as full

Post by xpt »

xpt wrote:As titled, I'm looking for a Linux based solution to print an arbitrary image on a full page, and better just the image, no any headers and footers.
FYI, no imagemagick necessary, merely the following will do exactly what I wanted:

Code: Select all

lp -o fitplot file.jpg
Post Reply