Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have an image, about 300x300 pixels large. I want to print as many copies as possible on a single page (I am planning to cut them apart with scissors afterwards).

Is there a way to do this? Is there a way to generate a PDF with copies (without opening something like gimp and manually doing copy-paste work).

share|improve this question

2 Answers 2

up vote 7 down vote accepted

You can use ImageMagick's montage tool.

  1. Install the imagemagic tools

    sudo apt-get install imagemagick
    
  2. Combine your images. I have created this image, called foo.png as a demonstration:

    enter image description here

    Run montage, telling it to make 3 rows of 5 images each (-tile 3x5), keeping the original size of the image (-geometry 300x400 and give it the same image 15 times as input:

    montage -geometry 300x400 -tile 3x5 foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png \
     foo.png foo.png foo.png foo.png foo.png foo.png foo.png  montage.ps
    

    The result is:

    enter image description here

  3. Since that creates a postscript file (the language printers speak), you can print it directly from the command line using tools like lp or enscript. I don't have a printer at the moment so I can't check but this should work

    lp montage.ps
    

    or

    enscript montage.ps
    
share|improve this answer
    
Hey, Tried this but I think the DPI is wrong, the images come out pixelated. -density 300x300 does not seem to help. Any ideas? –  GuySoft Mar 13 at 15:26
    
@GuySoft when you print them or in the image itself as well? Try using fewer images: montage foo.png foo.png foo.png foo.png foo.png foo.png -tile 2x3 montage.ps, just play around with the settings, you probably just need to get the number right so it fits on a single page. Also try Rinzwind's approach. –  terdon Mar 13 at 15:34
    
Would have tried @Rinzwind but not next to a printer now. Trying to figure out how to print to file with Rinzwind's solution. Also changing the tile number does not help, I should be able to fit much more on a page. [imgur.com/rbEj6Ee](Here is my image for reference). –  GuySoft Mar 16 at 8:36
1  
@GuySoft use the -geometry option to set the size of each image: montage -geometry 303x453 foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png foo.png -tile 3x montage.pdf gives me this pdf. –  terdon Mar 16 at 15:54
    
'-geometry' works I can generate PDF like this. thanks! –  GuySoft Mar 17 at 13:12

From Command-Line Printing in Linux.

N-Up Printing

The -o number-up=value option selects N-Up printing. N-Up printing places multiple document pages on a single printed page. CUPS supports 1, 2, 4, 6, 9, and 16-Up formats; the default format is 1-Up:

lp -o number-up=1 filename 
lp -o number-up=2 filename 
lp -o number-up=4 filename 
lpr -o number-up=16 filename

The -o number-up-layout=value option chooses the layout of the pages on each output page:

-o number-up-layout=btlr
Bottom to top, left to right
-o number-up-layout=btrl
Bottom to top, right to left
-o number-up-layout=lrbt
Left to right, bottom to top
-o number-up-layout=lrtb
Left to right, top to bottom (default)
-o number-up-layout=rlbt
Right to left, bottom to top
-o number-up-layout=rltb
Right to left, top to bottom
-o number-up-layout=tblr
Top to bottom, left to right
-o number-up-layout=tbrl
Top to bottom, right to left

So I assume it will be something like this:

lp -o number-up=4 number-up-layout=lrtb -d {printer} {filename} -n {copies} 

And it should print 4 images from left to right, top to bottom per page for the amount of {copies}. The numbers you can use seems fixed...


If this does not work please leave a comment.

share|improve this answer
1  
Is there a way to set -d to print to a file, and not a printer? –  GuySoft Mar 15 at 12:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.