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.
Related
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
I have been working on an image from last 25 days with zero output. So I came here in search of an answer.
I have a jpg image of 7MB. I upload it in Photoshop and changed the width to 96 Inch, Resolution for 300 pixels/inch, checked resample option and selected Preserve Details 2.0 and reduce noise to 100%. It gave me a 1.5 GB image as output.
Now I tried the same steps in image magic
gm convert -scale 768 -units PixelsPerInch -density 300x300 -resample 300x300 -noise 100% image.jpg -resize 768 image.tiff
Above command gave output in KBs. I need help.
If you want a 96inch wide image at 300dpi, you will need a width of 28,800 pixels, so start with:
gm convert input.jpg -resize 28800x result.jpg
That will resize the image to the correct width and do whatever is required with the height to preserve the image's aspect ratio - i.e. without distorting it.
I'm trying to crop an image into a bunch of 256x256 tiles (with the right-most and bottom-most images less than 256 pixels due to the remainders), but ImageMagick always generates images that are 1x1.
I use this command (Windows 7 command prompt):
convert WBS.png -crop 256x256 +repage +adjoin output\WBS_%02d.jpg
After cropping the following message is displayed:
convert: geometry does not contain image `WBS.png' # warning/transform.c/CropImage/589.
After cropping, the output folder contains 1634 jpg files, all of which are 1 x 1 pixel. The source image is 7218x7650.
Suggestions? I'm sure I'm making some blatant mistake, but I don't know what it is.
This can happen if the origin of the image is not at 0,0. In that case, using +repage before processing the image should do the trick, i.e.
convert WBS.png +repage -crop 256x256 +repage +adjoin output\WBS_%02d.jpg
See also the documentation of the -crop option.
I have a png whose width is 2551 pixels and whose height is 3578 pixels.
On this png, I use the -crop option of convert to cut out an image whose dimensions are 2362 x 3389 pixels:
convert original_2551x3578.png -crop 2362x3389+94+94 crop_2362x3389.png
This works as intended.
Then, I use convert to create a jpg:
convert crop_2362x3389.png -format jpg -flatten -background white out.jpg
I expected this command to produce a jpg with the same dimension (2362 x 3389). Much to my surprise, the produced jpg has the dimension 2551 x 3578 pixels (which is the same as the original image).
So it seems that somehow the original size is stored along with crop_2362x3389.png.
How can I use convert to convert a png into a jpg and have it keep the dimension of crop_2362x3389.png?
The reason you are seeing this is that when you do your initial crop, the image "remembers" it was part of a larger image and where in that image it used to be.
You can see this if you do your original crop and then run identify and look at the 4th field, just left of 8-bit.
convert original_2551x3578.png -crop 2362x3389+94+94 crop_2362x3389.png
You can also tell ImageMagick to "forget" it by using +repage like this:
# Repage after changing geometry to forget earlier geometry
convert original_2551x3578.png -crop 2362x3389+94+94 +repage crop_2362x3389.png
# Check IM has forgotten image used to be a part of a bigger one
identify crop_2362x3389.png
crop_2362x3389.png PNG 2362x3389 2362x3389+0+0 8-bit sRGB 256c 15.1KB 0.000u 0:00.000
Ok, I've found a solution. The geometry after the -crop parameter must be followed by a !:
convert original_2551x3578.png -crop 2362x3389+94+94! crop_2362x3389.png
This works as intended.
I have a YUV420 image of size 1280x720. I am trying to resize it to 720x576 using convert (Imagemagick) using below commandline options. But the generated output file doesnot seem to be a proper resized YUV420 image(I want the resized output also to be in YUV420 format):
convert -size 1280x720 -depth 8 -sampling-factor 2x2 test_1280x720_yuv420.yuv -filter lanczos -resize 720x576 -depth 8 -sampling-factor 2x2 720x576_yuv420.yuv //Here the output file size is not what it should be of a 720x576 YUV420 file which is 720x576x1.5 bytes.
Qiestion: What is the format of this output file then?
Also tried -sample option as, but same result. Incorrect sized output file. I even tried to display the generated resized file, but it sure is not a YUV420 file, as could not view it correctly at all.
convert -size 1280x720 -depth 8 -sampling-factor 2x2 test_1280x720_yuv420.yuv -sample 720x576 -depth 8 -sampling-factor 2x2 720x576_yuv420.yuv
Question: Would convert be able to do what I am trying to get done? IF yes, what are the options?
Question: Any other tool(freeware,shareware) which could help me resize YUV files(different formats YUV420, YUV444) to YUV format output files?
Try to ignore aspect ration!
Ignore Aspect Ratio ('!' flag)
If you want you can force "-resize" to ignore the aspect ratio and distort the image so it always generates an image exactly the size specified. This is done by adding the character '!' to the size. Unfortunately this character is also sometimes used for special purposes by various UNIX command line shells. So you may have to escape the character somehow to preserve it.
Example:
convert image.gif -resize 64x64\! resized_image.gif //Resized Image with ignore ratio option