Updated answer - now that I understand it better :-)
Basically, you can base64 encode an image using openssl like this:
openssl enc -base64 -in image.png > image.b64
However, if you want ImageMagick be able to read it, you first need a small headline to tell ImageMagick what to do. The title should contain:
data:image/png;base64,
followed by your base64 encoded data generated using the openssl command above. Thus, depending on what functions your shell has, you can do this with a compound statement in bash :
{ echo "data:image/png;base64,"; openssl enc -base64 -in input.png; } > image.b64
or like this on Windows:
echo data:image/png;base64, > image.b64 openssl enc -base64 -in image.png >> image.b64
Once you have an image in this format, you can proceed to process it using ImageMagick as follows:
convert inline:image.b64 result.png
For those using this in css, add the -A flag to output on a single line
openssl enc -base64 -A -in image.png > image.b64
Original answer
After many experiments, I can do it !!! :-)
Start by installing Eric (@emcconville):
# For example convert rose: rose.png # Create base64 file openssl enc -base64 -in rose.png -out rose.txt
and now add this mess as the last line:
{ echo "data:image/png;base64,"; cat rose.txt; } | convert inline:- out.jpg
I think data:image/png;base64, not in the base64 file created by openssl , so I create a compound statement that sends this, plus the file in stdin from ImageMagick .