imagemagic convert .png to .gif high quality - imagemagick

I have an animation from Blender rendered as 500 .png images, I want to convert these 500 images into a single looping .gif file, the images are 1080x1080. How do I convert them while keeping a high quality image?

convert -size 1080x1080 -delay 2 -loop 0 *.png output.gif
Without the -size flag I was getting artifacts for some reason trying to convert *.png output.gif this works,

Related

How to restrict tiff file size using ImageMagick and python?

I am converting a pdf to .tiff file using ImageMagick and calling it from python using subprocess,run() but, I want the output file size to be limited to a maximum value say 40MB. -define extent max_value is not working for tiff like it works for jpeg images.
This is my code:
subprocess.run('magick convert -density 150 example.pdf -trim -thumbnail 500 result%04d.tif')

Imagemagick animator keeps resizing my images when making gif

This seems like a question people may have asked indirectly before, but my question is more straightforward.
I have a folder of images sized 559x464 px.
[cbloecke#mac:cropped]% file file1_95w65w20n50n.png
file1_95w65w20n50n.png: PNG image data, 559 x 464, 8-bit/color RGBA, non-interlaced
All the png images have the same "95w" text in the filename. I use the imagemagick -loop and -delay commands to make them into an animated gif.
convert *95w*.png -delay 30 -loop 0 animated_95w65w20n50n_t.gif
But every time I do this, the resulting gif is resized larger with lots of empty space around it.
[cbloecke#mac:cropped]% file animated_95w65w20n50n_t.gif
animated_95w65w20n50n_t.gif: GIF image data, version 89a, 720 x 1080
I've tried using -trim and -resize 559x464 to reduce the size of the image, but they aren't doing anything. Why does imagemagick keep adding all this extra space? How do I trim it back down to the original 559x464?
Note: I'm working on a network where I have no control over the modules installed, so I'd prefer a solution in imagemagick, or potentially another default linux module.
Try repaging your images after you open them so they forget any previous virtual canvas sizes:
convert *95w*.png +repage -delay 30 -loop 0 anim.gif

Convert RAW to PNG with Imagemagick

I'm trying to convrt RAW image to PNG with Imagemagick.
Imagemagick version I'm using is 6.7.8-9.
The RAW image want to convert is:
https://drive.google.com/file/d/1V1c-ytjkLaCM3KbAc6Yxj2nfWzNkYohc/view?usp=sharing
My client gave me a big RAW image which contains more than 1000 RAW images and it is generated from Dicom. Firstly, I cropped just one image with the command (crop command did not work somehow, so used convert):
convert -size 512x512 -depth 16 UYVY:original.raw result.raw
result.raw appears good on ImageJ.
Now, I have no idea how to get PNG from it.
I tested some commands:
This one generated a very bad quality:
convert -size 512x512 -depth 16 gray:result.raw result.png
This one gets green-ish image:
convert -size 512x512 -depth 16 uyvy:result.raw result.png
If I open result.raw on ImageJ and save as PNG, it works perfectly.
I got an answer from Imagemagick community. Firstly, below code to get the first image from the original raw was wrong.
convert -size 512x512 -depth 16 UYVY:original.raw result.raw
This is the correct way (512*512*2bytes=524228)
head --bytes 524288 original.raw >firstimage.raw
Then convert to PNG:
magick -size 512x512 -depth 16 gray:firstimage.raw -evaluate AddModulus 50% -auto-level x.png
Here is another way in ImageMagick that I think is more intuitive to your signed raw data. I simply specify the data is signed using -define quantum-format=signed. Then stretch the result to full dynamic range using -auto-level.
convert -size 512x512 -depth 16 -define quantum:format=signed gray:original.raw -auto-level result.png
If using ImageMagick 7, then replace convert with magick.

Convert cropped images to gif with imagemagick : size conflict

I want to create an animated gif, I thus use this command :
convert -delay 50 --loop 0 cropped*.png animated.gif
where the cropped*.png are images that have been previously cropped from 1920x1080 size images with the command :
convert -crop 1105x441+92+168 source-1.png cropped-1.png
The command display -verbose gives this result :
PNG 1105x441 1920x1080+92+168
The problem is that the resulting gif, when played with eog or in any presentation software (libreimppress, etc) have the size 1920x1080 and not 1105x441. And I can't figure out why.

Using ImageMagick Convert PDF to Image and the converted Image name should start from 1 instead of 0

When I convert PDF to JPG using below command
#] convert -geometry 1024x768 -density 200 -colorspace RGB /opt/test.pdf +adjoin /tmp/check/test_%0d.jpg
I'm getting the output as
test_0.jpg
test_1.jpg
test_2.jpg
how can I have the sequence to be as below:-
test_1.jpg
test_2.jpg
test_3.jpg
If you're using ImageMagick 6.2 or greater you can use the 'scene' parameter to start at a particular number.. so something like:
convert -geometry 1024x768 -density 200 -colorspace RGB /opt/test.pdf +adjoin -scene 1 /tmp/check/test_%0d.jpg
should output the file sequence you want starting at 1.
+adjoin -scene 342 image_%03d.gif
would output image_342.gif, image_343.gif etc
Hope that helps

Resources