0

I use a command line application to create QR images from a given input text. I create enough of these and do some image editing, namely:

  1. resize the QR image,
  2. place on an office document
  3. type an index number next to the image
  4. repeat the above steps by adding more QR images next and below this image
  5. print an A4 page on the printer full of QR images.

The whole process is very repetitive and can be automated. But I don't know where to start from with this. I see gimp has "script-fu" based on the scripting "scheme" language but I can't find (or think of) some relevant function that can do the above. Sure the resize is easy, but adding text and creating a restricted image tile surface seems not as straight forward.

Is there some application that I could use that edits the image according to some script and places the result in an A4 image which will later be printed? Or am I plainly asking for too much? If it integrates weel with bash / python scripts then that is even better!

thank you

nass
  • 1,271
  • 18
  • 35

1 Answers1

1

IMO this will require some work; one way to accomplish this is doing the following:

  1. Create a svg template file with A4 size, layout it in a way that fits a page with several of the desired QR images. Something like the following:
 <?xml version="1.0" standalone="no"?>
 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
 <!-- A4 size -->
 <svg width="210mm" height="297mm" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

      <image xlink:href="_qr_image_here_1_" x="0" y="0" height="50px" width="50px"/>

      <image xlink:href="_qr_image_here_2_" x="60" y="0" height="50px" width="50px"/>

      ... <!-- More Images --> ...  
 </svg>
  1. Code a shell script that calls sed to replace the xlink:href="_qr_image_here_N_" attributes with the path to the QR images you want to fit in (the svg file tools would take care of the resizing process for you).
  2. Generate several of these svg documents from your script, these files will represent the pages of your doc.
  3. Convert all the svg files to pdf, you can use rsvg-convert for this, more info here.
  4. Merge all the pdf generated pages into one pdf file, you can use pdftk for this, also you can find info on how to do this step here.
Community
  • 1
  • 1
higuaro
  • 14,758
  • 3
  • 32
  • 40