Page 1 of 1

convert set of jpg files into huge pdf: how to add filenames

Posted: 2013-10-01T05:36:36-07:00
by aloist
I use 'convert' to create huge PDF files from a set of JPG images. Each image becomes one page in the resulting PDF.

is there a way to make the file names of the JPG files appear as well in the created PDF, as an annotation somewhere on each page?

Re: convert set of jpg files into huge pdf: how to add filen

Posted: 2013-10-01T05:53:16-07:00
by magick
Try -set label %f.

Re: convert set of jpg files into huge pdf: how to add filen

Posted: 2013-10-02T10:28:23-07:00
by fmw42
If you do not mind the filenames add outside the image, then try

montage -label "%f" -tile 1x1 image1.jpg image2.jpg .... result.pdf

Re: convert set of jpg files into huge pdf: how to add filen

Posted: 2013-10-02T10:48:40-07:00
by fmw42
Here is another way that lets you put the filename inside the image. You can place it with -gravity ... -geometry ...

convert image1.jpg image2.jpg ....imageN.jpg -set filename:myfilename '%f' \
-gravity north -pointsize 15 -fill white -annotate 0 "%[filename:myfilename]" result.pdf

Re: convert set of jpg files into huge pdf: how to add filen

Posted: 2013-10-04T06:44:23-07:00
by aloist
Thanks a lot for the swift and excellent help.

As these are grayscale scan documents, some near white, some near black, I used the third recommended version, with 'fill red'
and got escellent results.

Re: convert set of jpg files into huge pdf: how to add filen

Posted: 2013-10-07T23:15:53-07:00
by anthony
Note I would not use filename:filename whcih is special for use in output filenames not for annotations

Why not just use %f directly in the annotation?

Code: Select all

convert image1.jpg image2.jpg ....imageN.jpg  \
         -gravity north -pointsize 15 -fill white -annotate 0 "%f" \
         result.pdf