Convert multiple base64 images to multi page pdf

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
mrbushido
Posts: 5
Joined: 2017-02-01T21:17:15-07:00
Authentication code: 1151

Convert multiple base64 images to multi page pdf

Post by mrbushido »

Hi,

I have multiple base 64 image strings in a txt file. I can combine the strings into one base64 string and convert them to a pdf but it does not write each base64 image to a different pdf page, it just writes them to one really long page. Also if I try multiple base64 strings, the conversion does not work. Here's my command that works:

/usr/bin/convert inline:blob.txt -quality 100 -density 120 complete.pdf

If the "blob.txt" file contains :

data:image/png;base64,stringheredata:image/png;base64,stringhere

it does not work

Basically my goal here is to get each base64 string (image) on a different page of the pdf

Any help would be appreciated, thanks
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert multiple base64 images to multi page pdf

Post by snibgo »

What happens if you have one text file per base 64 image?
snibgo's IM pages: im.snibgo.com
mrbushido
Posts: 5
Joined: 2017-02-01T21:17:15-07:00
Authentication code: 1151

Re: Convert multiple base64 images to multi page pdf

Post by mrbushido »

Thanks for this, that almost worked but it just put the text straight in the pdf, I then added inline: and it put the images properly in the pdf on separate pages, the final command was:

/usr/bin/convert inline:blob0.txt inline:blob1.txt -quality 100 -density 120 complete.pdf
Post Reply