Putting an image onto an A4 PostScript

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
rustutut
Posts: 3
Joined: 2019-05-15T22:39:05-07:00
Authentication code: 1152

Putting an image onto an A4 PostScript

Post by rustutut »

I'm trying to do something that I though would be trivial, but it just won't work.

I have pairs of images and to combine them for previewing, I use
montage a.png b.png -tile 1x2 -geometry 600x300 result.png

Now I wanted to print them in proper quality and came up with
montage -density 1200 a.png b.png -tile 1x2 -geometry 6000x3000 result.ps
which basically is fine, however, the PostScript generated does have a non-standard paper size and this is where I'm stuck. I tried "-page a4", which does have some effect, but not the one I expected. Then I tried
convert -page a4 -density 1200 xc:white test.ps
and expected to get an A4 page and 1200 dpi, but I get Letter and 72 dpi.

Am I doing it wrong? Is this something that cannot work for some reason?
ImageMagick 7.0.8-22
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Putting an image onto an A4 PostScript

Post by snibgo »

For v7, I suggest you use "magick montage", not just "montage".

"-page A4" sets the size of the virtual canvas on which your image sits. How large is your montaged image, in pixels? A few thousand pixels, I suppose.

See the docs http://www.imagemagick.org/script/comma ... s.php#page . "A4" is 595x842 pixels. I suppose this is far smaller than your image, so doesn't do what you want.

Instead, I suggest you use "-page WxH" or "-extent WxH" where you calculate W and H so that both dimensions are at least as large as your image, and they are in the ratio 1:sqrt(2) or sqrt(2):1 (the aspect ratios of A4 portrait or landscape).
snibgo's IM pages: im.snibgo.com
rustutut
Posts: 3
Joined: 2019-05-15T22:39:05-07:00
Authentication code: 1152

Re: Putting an image onto an A4 PostScript

Post by rustutut »

I still don't get it:

magick montage -extent 2100x2970 xc:white montage.ps
magick identify montage.ps
montage.ps PS 128x126 128x126+0+0 16-bit sRGB 2832B 0.000u 0:00.000

Seems to be very small, evince tells me it's 45x44 mm. So I tried adding zeroes and expected to end up with about 450x440 mm:

magick montage -extent 21000x29700 xc:white montage.ps
magick identify montage.ps
montage.ps PS 128x126 128x126+0+0 16-bit sRGB 2832B 0.016u 0:00.000

still 45x44 mm.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Putting an image onto an A4 PostScript

Post by snibgo »

Perhaps "-extent" isn't an option for "magick montage". You can run multiple commands with piping:

Code: Select all

magick montage rose: logo: miff:- |magick - -extent 2100x2970 info:

- MIFF 2100x2970 2100x2970+0+0 16-bit sRGB 0.438u 0:00.327
snibgo's IM pages: im.snibgo.com
rustutut
Posts: 3
Joined: 2019-05-15T22:39:05-07:00
Authentication code: 1152

Re: Putting an image onto an A4 PostScript

Post by rustutut »

If anyone else is trying to do that, here's what worked for me:

montage -density 300 rose: logo: -tile 1x2 -geometry 1500x1000\!+2+2 - | magick -density 300 -gravity center - -extent 2480x3507 magic2.ps
Post Reply