Mayank
Mayank

Reputation: 87

How to add a logo and notes using ImageMagick

I want to create a contact sheet (thumbnails of images) which needs to have a logo at the top left corner, a set of images and notes appended at the end.

I am trying to achieve this by first converting the notes text to a pdf using:

convert -background white -fill black -font arial.ttf -pointsize 36 -size 1024x128 caption:'This is sample text' textPdf.pdf

Then, creating a contact sheet (thumbnails of images with title and caption) by using montage function which returns a pdf with multiple (6) pages. And,

Finally merging the above two pdfs with the logo as below:

convert logo.jpg montage.pdf textPdf.pdf -background none -append contactsheet.pdf

This however, appends all the pages (6) into a single paged pdf which renders the contact sheet useless as on printing this thumnails become too tiny to be identified.

Is there any other way by which I can add a logo at the top of each of the pages of the montage.pdf and append the textPdf.pdf at the end of the last page of the pdf?

Any help in this would be much appreciated.

Upvotes: 2

Views: 505

Answers (1)

Kurt Pfeifle
Kurt Pfeifle

Reputation: 90213

If I understand correctly, you have this:

  1. logo.jpg (1 image of unknown dimensions)
  2. montage.pdf (a 6-page PDF with some arbitrary page size)
  3. textPdf.pdf (a 1-page PDF with a very weird page size).

You want to create an output PDF of 7 pages named contactsheet.pdf, where

  • ...the 1st page consists of the logo.jpg with the vertically appended 1st page from montage.pdf
  • ...the 2nd page consists of the logo.jpg with the vertically appended 2nd page from montage.pdf
  • ...the 3rd page consists of the logo.jpg with the vertically appended 3rd page from montage.pdf
  • ...the 4th page consists of the logo.jpg with the vertically appended 4th page from montage.pdf
  • ...the 5th page consists of the logo.jpg with the vertically appended 5th page from montage.pdf
  • ...the 6th page consists of the logo.jpg with the vertically appended 6th page from montage.pdf
  • ...the 7th page consist of the one weird pagesized textPdf.pdf.

This result can be achieved with the following command:

 convert \
    \( logo.jpg tiled.pdf[0] -background none -append \) \
    \( logo.jpg tiled.pdf[1] -background none -append \) \
    \( logo.jpg tiled.pdf[2] -background none -append \) \
    \( logo.jpg tiled.pdf[3] -background none -append \) \
    \( logo.jpg tiled.pdf[4] -background none -append \) \
    \( logo.jpg tiled.pdf[5] -background none -append \) \
    textPdf.pdf \
    contactsheet.pdf 

It makes use of the following advanced ImageMagick commandline features:

  1. bracketing sub-commands inside \( ... \) (which each require a space before and after!) to create partial picture results;

  2. using the 0-based [N]-index to address a particular image/frame/page of a multi-page image or PDF file.

Upvotes: 4

Related Questions