Why is magick giving an error while converting base64 files? - imagemagick-convert

I have a bunch of base64 encoded images which I want to convert to their corresponding image files using magick (ImageMagick version 7). I can paste the base64 directly into various online converters which works. But command-line magick is failing.
Example of a file is attached in "x.txt". Pasting it into an online converter like https://onlinejpgtools.com/convert-base64-to-jpg readily yields an image. But this command line fails:
magick inline:`cat x.txt` x.png
This says "magick: corrupt image". If I remove the "inline" part, I get "magick: unable to open image". Here is a link to download the sample file x.txt:

In Imagemagick, try (no cat). That works for me.
magick inline:x.txt x.png
Or pipe from cat to magick as
cat tmp.txt | magick inline:- y.png

Related

ImageMagick no decode delegate for this image format `PDF' Windows

Trying to play with ImageMagick to read scanned PDF texts, but at the point to convert the PDF to image, I've got this error, where it shows "no decode delegate for this image format `PDF' # error/constitute.c/ReadImage/504". Been search for this solution for hours to no avail, need some help here.
OS: Windows 7 x64
ImageMagick Version: ImageMagick-6.9.8-10-Q16-x86-dll.exe
convert -list format
shows below output
Format Module Mode Description
-------------------------------------------
* native blob support
r read support
w write support
+ support for multiple images
Looks like your delegates are not properly configured,
Once Ghostscript is installed make sure the binary folder C:\Program Files/gs/gs3.0.9/bin is added to your path.
Once Done, there should be a file names delegates.mgk in you graphics magick home directory. Open that file in a text editor.
<delegate decode="pdf" encode="eps" mode="bi" command='"#PSDelegate#" -q -dBATCH -dSAFER -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=#GSEPSDevice# "-sOutputFile=%o" -- "%i" -c quit' />
In the whole file, find and replace #PSDelegate# with gswin64c and it should get the job done.

Base64 jpg to base64 Png in Ruby

I'm working with base64 files and i would like to convert a base64jpg image in a base64png image. Is there a way to do it?
The reason is i'm using rsvg-convert to convert svg files into png files, but when i have a base64jpg in my svg, it's not working, But it works with base64 files.
In ImageMagick, this works for me.
Create JPG base 64 file:
convert rose: rose.jpg
convert rose.jpg inline:rose_base64jpg
The text file rose_base64jpg shows:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDA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fEJnzIUx7A8UjoEJsykEAKS0S4+lXVsW+X93Pntyx+c+VC5tZnuH2J9IoezVHdn16dNmvanJTpdunaw/KLegAH0wTgbKD2oPMhQ5Y5zVMmBMiESocqw1DYkg/yMWGAI5qA4PdE1cVVzREUuRJTpakIc1JWb7tkAXsLgDFGIop3Ad1Vyuc4r//2Q==
Convert from base 64 JPG to base 64 PNG:
cat rose_base64jpg | convert inline:- PNG:- | convert - inline:rose_base64png
The text file rose_base64png show:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAAuCAIAAAAa6/jkAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAbA0lEQVRo3k2aSa+mx3Xfzzk1PNP7vMOd7+154tQiaYqkJVGWTBm2IjuQbCS2tk4WWSaLfI0g8AdwVnECBMjKSAQ7AWLYgMM4tqPYpCiR6ia72d237/iOz1zDOVmQVHwWVUCt6o+qc2r4/fH1176iERShJgAAEQEAAEABEWFm+TwQACCKkGIkrZRSqI1VqSatBCUYMKD9FYTXxVxBnRPt++SGzxLXVzl9Js0idAOwE6gVr8EHMpGBgdAxjnMK4bZTpbEfkf6Ten6sM2nZh44yBYNA0F61uVjfqXvT8u1tPT16qb767oN1cv6zP426eeH1qzfu7D199OjZ4ydaACIgCgQGACBBAGD8UhWQgCAhAjCCAhAMiEoEGZEjBGQUEAAVWZMOxMvWjcDbogSrPULaMwP0HGqMUSkvHAGFMaCOXTemFJmquskU5ulYkB1DjFFzSER50hzBcRQSRVabZJC4cIs55BKaIbogJsbJsqqPj6skT+rGDT7qKCACgqJAfrFEACCkkEEECAG/GPu818IkAMKMAgTEEBGEDYAhETLshcHxIEb1xr9sZFDQRF+JZ4WRYYjCQj1hgrZOlCAPJAVQFtEluN4pm7jqGk8goiQocRpZoxnSqvOos0XvPjhe3kz4+gsHqksG1l2gh4+On559mtk4G+eagQAYBFn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is generating black images while converting pdf to jpg

Image Magick version in use is 6.8.8.1.
Via command line on windows I am just trying to convert a *.pdf file into .jpg file using the following command
convert -density 100 -colorspace RGB "input.pdf" "output.jpg"
But the resulting output.jpg file is with a black image (there is no content). Any one out there could please guide on this ?
When you open this PDF-file by using a text-editor and it's header contains something like this:
%PDF-1.5
%¦éÏÄ
4 0 obj
<</Length 5 0 R/Filter /FlateDecode>>stream
....
....
then you have to decode this flat-encoded stream first before you can convert it to an image.
To solve this problem:
You can use the GUI-Tool pdftk free, set your environment-path to the bin-folder within the pdftk-folder and execute:
pdftk ENCODED_FILENAME.pdf output DECODED_FILENAME.pdf uncompress
in the shell to deflate/unzip this file.
Create a new file that is not encoded or zipped.
Hope this helps.
Set alpha flag to off in convert command.

How to crop 486 pixels from the bottom of each JPG image in the folder with ImageMagick?

How to crop 486 pixels from the bottom of each JPG image in the folder with ImageMagick?
The following command
magick -crop -0-486 *.jpg
says
magick.EXE: no images found for operation `-crop' at CLI arg 1 # error/operation.c/CLIOption/524
magick.EXE: no image to apply a property "%w" # warning/property.c/GetMagickPropertyLetter/2561.
magick.EXE: unknown image property "%w" # warning/property.c/InterpretImageProperties/3499.
magick.EXE: no image to apply a property "%h" # warning/property.c/GetMagickPropertyLetter/2449.
magick.EXE: unknown image property "%h" # warning/property.c/InterpretImageProperties/3499.
magick.EXE: no image to apply a property "%m" # warning/property.c/GetMagickPropertyLetter/2480.
magick.EXE: unknown image property "%m" # warning/property.c/InterpretImageProperties/3499.
Please, give specific example, internet in controversal (various names like mogrify, convert, various commands etc). Also don't point to ImageMagick "Talmud". Need just a simple example.
OS is Windows, Magick is installed with Chocolatey.
Please make a backup of your images before using the following commands.
The command for a single image is convert or if you have ImageMagick 7+, it is magick.
The command for multiple images is mogrify, or if you have ImageMagick 7+, it is magick mogrify.
The command you want is as follows and it will chop 486 pixels off the bottom of each image in the current directory:
magick mogrify -gravity south -chop x486 *.jpg
The main ImageMagick command command used to be called convert but there is a Microsoft tool with the same name that has caused confusion for years, so all the ImageMagick commands were prefixed with magick, followed by the old name. So,
animate ...
becomes:
magick animate ...
And
mogrify ...
becomes:
magick mogrify ...
In the case of convert, which is the most common usage, you can now use
magick convert ...
or simply
magick ...
where convert is implied.

Converting tiff to mode 1 bit images

Is it possible to convert a tiff image to mode 1-bit image using command line tools. I saw it can be done with gimp but I need to run a script so I prefer a solution using packages like imagemagick etc
If the image contents is already black and white, and you just need to convert, use:
convert input.tif -depth 1 output.tif
If you also require to threshold the image, use something like:
convert input.tif -separate -black-threshold 128 -depth 1 output.tif

Resources