Imposition

From XPUB & Lens-Based wiki
Revision as of 18:34, 17 November 2017 by Andre Castro (talk | contribs) (Created page with "= Imposition = How to program an [https://en.wikipedia.org/wiki/Imposition imposition] of different images (of different ratios and orientations) into a single sheet of paper...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Imposition

How to program an imposition of different images (of different ratios and orientations) into a single sheet of paper? Creating a Print Signature, to be folded into a saddle stitched book of 16 pages from one single sheet of paper.

Source: http://www.piratespress.com/art_problems/images/imposition1.png

Source: https://image.slidesharecdn.com/08imposition3-121128184928-phpapp01/95/16-page-imposition-method-1-638.jpg

same size source images

Imagemagick is a powerfull tool to perform all sorts of manipulations on images, and one that affords many options concerning resizing. Although possible it is not always obvious how to perform slighlty more complex tasks with it.

How to resizes images which we want in the imposition onto files of the same dimensions? Taking into consideration the images' different ratios and orientations, which should not be cropped or distorted .

One option is to place the images onto frames of the same size.

In order to create same size frames Imagemagick provides the -extent operator which adjust the final size of an image , without resizing it. According to IM documentation, "[i]f the image size increases, space will be added to right or bottom edges of the image. If it decreases the image data is just junked or cropped to fit the new image size."

convert -background black -extent 297x421 -gravity Center input.jpg output.jpg

If the input image is larger than 297x421 you should get a cropped image, with its gravity point in the center of the image. Although North, South, East, West are other possible values for -gravity. Input images with dimensions larger than -extent values, space will be added to right or bottom edges of the image.

Note: to find an image's dimension of an image IM provides the identify utility which can be invoked simply with: identify image.jpg

As cropping or junking the image is something we want to avoid, a solution might be to also resize the image to the same dimensions given to -extent using the -resize parameter

convert -background black original.jpeg -gravity Center -resize 297x421 -extent 297x421 extend_297x421.jpeg

01 extent.png

To perform that operation in all images of a directory, we can use a for loop:

for i in dir/*; do convert -background black $i -gravity Center -resize 297x421 -extent 297x421 extent_$i;done

Montage

After resizing all images, the next step, towards the imposition, is to use those images to create a mosaic using the IM montage command.

It is useful to look at the bash script feautured in this Scribus page on imposition to get a few hints on how this is done. Although programming such a task in bash is a daring and messy job :).

In its simplest form a 4x2 montage can be invoked with:

montage -geometry +1+1 -tile 4x2 01.png 02.png 03.png 04.png 05.png 06.png 07.png 08.png 4x2.jpg

  • -geometry '+1+1' defines the spacing between tiles: +from_left_to_right+from_top_to_bottom
  • -tile 4x2: how the tiled images are to be laid out
4x2.jpg

Montage: Order & Rotation

Notice that the distribution of tiles goes from top left to bottom right. Such order, wont result in a correct page ordering when folded into a booklet.

To achieve the correct page ordering for the book let we'll have to provide the order: * single-side: [3, 6, 5, 4, 2, 7, 8, 1] * double-sided: [5, 12, 9, 8, 4, 13, 16], [1, 7, 10, 11, 6, 2, 15, 14, 3]

montage -geometry +1+1 -tile 4x2 03.png 06.png 05.png 04.png 02.png 07.png 08.png 01.png 4x2_order.jpg

4x2 order.jpg

As the top part of the imposition sheet will be folded down, its content will be inverted in the booklet. To correct that we can rotate the uppper 4 tiles 180 degrees with -rotate 180.

montage -geometry +1+1 -tile 4x2 \( -rotate 180 03.png 06.png 05.png 04.png \) 02.png 07.png 08.png 01.png 4x2_top180.jpg

4x2 top180.jpg

page size

If IM's identify is asked provide to give information on A4 and A3 pdfs: identify A4.pdf. I will get the following reply: * A4 210x297mm 8.3x11.7inch 2480x3508px (at 300 dpi) 595x842 (at 72dpi) * A3 297x420mm 11.7x16.5inch 3508x4960px (at 300 dpi) 842x1191px (at 72dpi)

Note the size in pixels changes when in relation to the resolution: 300 or 72 pdi.

The resulting value is nothing more than: page_height_inches*resoltuion X page_height_inches*resoltuion

(8.3inch * 300dpi) X (11.7inch * 300dpi) = 2480x3508px

More of paper sizes in inch,mm,px: http://www.papersizes.org/a-paper-sizes.htm

convert to page size

After creating the montage with the same ratio as A4 & A3 the next step will be convert it to a PDF with the right dimensions PDF, so it can be sent to the printer.

convert 4x2.jpg -gravity Center -resize 3508x2480 -units PixelsPerInch -density 300x300 4x2_a4_300dpi.pdf

Produces a PDF with 3508x2480px and 11.6x8.26inch

  • -units specifies the units of image resolution: Undefined, PixelsPerInch, or PixelsPerCentimete
  • -density specifies the resoltion
  • -gravity Center resize gravity point

Bibliography

[http://gen.lib.rus.ec/book/index.php?md5=B81926E451AAF52B59AC76AE2233CC1D

Johansson, Kay; Lundberg, Peter. Robert Ryberg, ed. A Guide to Graphic Print Production. Wiley. ]