Say I have an image image1.jpg
I can encode it using base64 tool :
myImgStr=$(base64 image1.jpg)
I tried to decode it using the following command:
base64 -i -d $myImgStr > image2.jpg
or
echo -n $myImgStr | base64 -d -i > image2.jpg
But in both cases I get the following error:
base64: extra operand ‘/9j/4AAQSkZJRgABAQAAAQABAAD/7QCEUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAGgcAmcAFHNH’
Try 'base64 --help' for more information.
Any help is appreciated.