Mail Merging

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
gleasonkeanan
Posts: 3
Joined: 2018-10-03T11:43:43-07:00
Authentication code: 1152

Mail Merging

Post by gleasonkeanan »

Hello, I am completely new to ImageMagick (and open source software in general for that matter), but would like to use it to mail merge the customization of infographics. I have a .csv file with individualized information contained in each row. I would like to write a command to populate blank spaces in a .png file with the information from excel and save a version for each person. It seems like I would need to use either mogrify or convert to do this, but I'm not exactly sure how to start writing the command. Any suggestions? Is this something someone with no experience could do? Will I need to use multiple programs?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mail Merging

Post by fmw42 »

I do not know much about mail merge, but this seem like it would need a lot of scripting to use Imagemagick. I think it is possible, though.

You would have to use a script to read each entry from your csv file and then write that either to certain locations in a background image or create a new image for each piece of text and then composite that in the correct location in the background image.

Can you post your csv file and images to some free hosting service and put the URLs here. You could zip all the data and post the zip file to keep it all in one URL.

______________________

Please, always provide your IM version and platform when asking questions, since syntax may differ.

Also provide your exact command line and your images, if possible.

See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620

If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli


For novices, see

http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
gleasonkeanan
Posts: 3
Joined: 2018-10-03T11:43:43-07:00
Authentication code: 1152

Re: Mail Merging

Post by gleasonkeanan »

Link to folder containing the .csv file and .png image: https://drive.google.com/drive/folders/ ... sp=sharing

I'm using IM version 7.0.8 on Windows. I don't have any command lines to provide as I'm still learning the options for mogrify and convert. Please let me know if this seems like a task too complex for a novice so that I may stop wasting my time. All other help is greatly appreciated.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mail Merging

Post by fmw42 »

You did not provide the template, but I presume you know where on the template you want each text to go.

For a novice who has no programming/scripting experience, there would be an extensive learning curve.

The basic idea as I understand it, would be to extract each cell of the spread sheet, knowing where each is supposed to go. This would requires some scripting to parse the spreadsheet after converting to say csv format so that it could be parsed by commas. Then once you have the list of text, you would use imagemagick to write each text string in the pre-designed locations.

Sorry, I am not a Windows user, so I could not help with scripting on your platform/OS.
gleasonkeanan
Posts: 3
Joined: 2018-10-03T11:43:43-07:00
Authentication code: 1152

Re: Mail Merging

Post by gleasonkeanan »

That's the basic idea. I think we are going to outsource this task to someone who actually has programming experience. Thanks anyways for your help!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Mail Merging

Post by fmw42 »

If you decide to use Imagemagick for part of the processing, see https://imagemagick.org/Usage/text/ for different ways to convert/add text to an image.
Post Reply