I am trying to convert a 8 page pdf to 8 separate pbm files, using imagemagick. When I do convert test.pdf test.jpg, 8 jpg files (test-0.jpg, test-1.jpg ..) are created, but when I use the command convert test.pdf test.pbm only 1 pbm file (test.pbm) is created. What should I do?
convert test.pdf out-%0d.pbm
This will give you out-0.pbm out-1.pbm... I don't know why imagemagick does this automatically for jpg but not for pbm.. If you want to pad the number to be 000-999 then add a "3" in front of the d.
Example:
convert test.pdf out-%03d.pbm
Related
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
I have found multiple posts regarding this issue and everyone is recommending ImageMagick but for me, it doesn't seem to work as intended and I don't see too many docs on their site regarding .jpg->.pdf conversion.
Is there some alternative, preferably CLI tool?
Or can I somehow debug why ImageMagick doesn't work for me? I don't get any errors I just get corrupted files as a result.
My usecase
My os is Windows and
I have 64 .jpg files called 0.jpg, 2.jpg, ... 63.jpg and I would like to merge all those images into one .pdf file.
I have tried these commands:
magick *.jpg out.pdf
convert *.jpg out.pdf
but in both cases, I am unable to open the out.pdf file because it is corrupted. I have noticed that I can only convert 0.jpg file to pdf correctly but when I try to convert any other of my 64 jpg files then as a result I am getting a corrupted .pdf file
For example:
This gives me the correct .pdf:
magick 0.jpg 0.pdf
but this gives me corrupted .pdf:
magick 2.jpg 2.pdf
I assume that this a reason why I can't merge all of the files into one not corrupted .pdf file and my assumption is that there is something wrong with the rest of my .jpg files but I have no idea how to debug this issue. Every other .jpg file looks exactly the same as the one .jpg I can convert and all of them open without issues.
magick identify -verbose foobar.jpg results:
I can convert 0.jpg file to .pdf correctly but 2.jpg results in corrupted .pdf.
There are some apparent differences but I am not sure what those properties mean in the context of .jpg -> .pdf conversion
One thought is that someone has converted the grayscale image to color with 3 equal channels so that it IM says it has colorspace RGB. However, the JPEG colorspace tag is 2, which says it has no specific colorspace.
Properties:
date:create: 2021-04-01T17:29:06+00:00
date:modify: 2021-04-01T05:18:58+00:00
exif:ExifOffset: 46
exif:ExifVersion: 48, 50, 50, 48
exif:PixelXDimension: 960
exif:PixelYDimension: 1508
exif:Software: Google
jpeg:colorspace: 2
jpeg:sampling-factor: 2x2,1x1,1x1
From the JPG docs
ColorSpace
0 = Bi-level
1 = YCbCr, ITU-R BT 709, video
2 = No color space specified
3 = YCbCr, ITU-R BT 601-1, RGB
4 = YCbCr, ITU-R BT 601-1, video
8 = Gray-scale
9 = PhotoYCC
10 = RGB
11 = CMY
12 = CMYK
13 = YCCK
14 = CIELab
It is possible that this conflict or lack of colorspace may confuse certain viewers after the file is imbedded in a PDF vector shell.
Thank you #Mark Setchell for pointing me in the right direction by sharing this command:
magick identify -verbose XXX.jpg
My images are grayish so I don't know why majority of the files has sRGB colorspace but after converting colorspace to Gray I can convert them to .pdf properly (I don't see any difference when I open up my .jpgs after conversion to grayscale).
Using this command I can change colorspace to Gray:
magick 2.jpg -colorspace gray gray2.jpg
Then I can convert "grayscale" .jpgs to .pdf by simply:
magick gray2.jpg gray2.pdf
P.S.
If anyone has some better solution I will gladly accept it but if nothing shows up I am going to accept this
#fmw42
Here is a .zip file that contains
20.jpg - source image
20.pdf - corrupted pdf after running >magick 20.jpg 20.pdf
gray20.jpg - source image converted to gray by >magick 20.jpg -colorspace gray gray20.jpg
gray20.pdf - source image converted to .pdf after changing colorspace to gray first by >magick gray20.jpg gray20.pdf
Keep in mind that this image is from some weird manga but I have tried to pick the most normal page (it was harder than it seemed to be but this image itself is not nsfw)
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/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBD/wAARCAAuAEYDAREAAhEBAxEB/8QAHAAAAgIDAQEAAAAAAAAAAAAABgcEBQMICQEC/8QANRAAAQMCBAMGBAUFAQAAAAAAAQIDBAURAAYSIQcxQQgTIlFhcRQygcEjQlJikRUWJDOx0f/EABwBAAIDAQEBAQAAAAAAAAAAAAUGAwQHCAIBAP/EADARAAIBAwQABAQGAgMAAAAAAAECAwAEEQUSITEGQVFhExQigQcjMnGhwRWxQlLh/9oADAMBAAIRAxEAPwDSvuJ6W7toJA9MRHaTUiFsVh/yS4UrZN/UY+lVFetzY5qzgKmsIU6GlJSNuWIHCH6akjB7o4yVnJ6nT22FpUEqGySLgn/3AbULIMN690/+D9ffS5RHns5HVFlczAmY8t5KShKkgBKuYsN8BVtGX9VP+reIf8jK0nWfKpuRqLJq+YGYcpKowKwHO9SUlAPUg++2Lgtg4wTileTXBpjGQoWZQcKBliceg59/2oM42cM6tkqsS6kww9JpTr6rPlNyi5vY2wxW0qYCA9Vj/wA81/KzScOxJ6r77OUhL+e1QJTrzNPfhvd8tCfCF6bIubbc/rbF+K9j02eO7dd23PANSy3MkNo8YP0t/VNnPeS6RkXL0aFCzhUq3HM5ZabUwhttsKSSSALqvcW3NvTFOfURfyGRE20JgvmlYnFa/wBNYlRZJiT2trEpUBzx5kl+klaMpGQcGnzP7Kb9fyPT83ZJzImRIlxW33IElmyioi6tKh98OaeEvj26T28n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/OlBP4jthZKSrqABYYkhjESADzqxIBuxVDxi4DcPOM0JDOaYDkepIToi1WEEolMg38JUQQtH7VAjysd8V7uzhvsBhg+tFtH1290eQm2b6T2p5U/b1965zdqTsxvdneXRivOTdejV9UgM3gGO4wG9HzfiKCr6+luWBksfy7bG5okfEJnzIUx7A8UjoEJsykEAKS0S4+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+rGDT7qKCACgqJAf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xGAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE3LTEyLTA0VDEwOjQ5OjAxLTA4OjAwvhtpxwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxNy0xMi0wNFQxMDo0OTowMS0wODowMM9G0XsAAAAASUVORK5CYII=
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.
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