I'm trying to chop the following gif as to remove four of the inner videos:
I use this command:
convert bair_action_free_00232.gif -gravity NorthWest -chop 256x0+65+0 vid_pred.gif
The result looks really bad; the black frame flickers and the text looks awful.
Adding -quality 99 doesn't help. Any tips?
Gif Reference: https://alexlee-gk.github.io/video_prediction/
I think you want this:
convert vid.gif -coalesce -chop 256x0+65+0 -delay 80 result.gif
Related
I use ImageMagick (with Windows 10) to convert my .pdf in .png, for example:
convert -background white -alpha remove -density 150 "mydoc.pdf" -quality 100 "mydoc.png"
I'd like to know if there is an option that automatically (that is without explicitly giving the size) cut out the written part of a page.
For example, from an image like this:
get an image like this:
What you are looking for is the -trim option:
http://www.imagemagick.org/script/command-line-options.php#trim
Simply add it to your command. You might also add the +repage option to reset the canvas offset:
convert -background white -alpha remove -density 150 -trim +repage "mydoc.pdf" -quality 100 "mydoc.png"
I want to add watermark images to GIF animations with ImageMagick.
The following doesn't work: it just gives produces a weird single image with crazy colors, and the transparent-watermark.png doesn't seem to be there at all.
composite -compose Dst_Over background-gif.gif transparent-watermark.png final.gif
How can this be accomplished? It's similar to annotating but with an image instead of text.
convert background-animation.gif -coalesce -gravity NorthEast -draw 'image over 0,0 0,0 "transparent-watermark.png"' -layers Optimize final.gif
I've had same problem with
convert -delay 4 -loop 0 *.png animated.gif
And fix it adding -alpha remove
convert -delay 4 -loop 0 *.png -alpha remove animated.gif
Try -alpha remove or -background white(other cases) to fix it.
I'm using ImageMagick to rotate animated gifs. Simply:
convert image.gif -rotate 32 -alpha set -background none output.gif
Output:
https://s3-eu-west-1.amazonaws.com/uploads-eu.hipchat.com/108112/892631/ATp8mXXrDdSkCNu/sowa-test2.gif
Does anyone have a clue why output image is distorted this way and how to avoid this?
Without seeing the original image, I would suggest extracting each image, apply rotation, and then re-build the animated gif.
Example using the following gif:
convert anim_none.gif -scene 1 +adjoin tmp_%02d.gif
mogrify -rotate 32 -alpha set -background none tmp_*.gif
convert tmp_*.gif -loop 0 final.gif
And note: quality is expected to degrade with rotation operations.
The solution from emcconville didn't quite work for me. Part of the issue may have been that my layers were transparent and so not all the same dimensions. However, using his solution as a base and then modifying it based on things I saw elsewhere, I was able to get my gif rotated:
convert my_gif.gif -background transparent \
-virtual-pixel background -coalesce tmp_%02d.gif
mogrify -rotate -45 -background transparent -virtual-pixel background tmp_*.gif
convert tmp_*.gif -loop 0 my_gif_rotated.gif
Hopefully this helps others.
I want to convert different image formats (bmp,jpg,gif,png,tiff-incluging multipaged) into a PDF format with A4 page size and with images fit to page (resized if necessary). Image should be positioned at the center of the page and I'd like to define an offset.
I tried the code below but there is no offset at the top and the image quality is really poor.
convert png.png -gravity North -resize 500x500 -quality 100 -page a4x5x5 myout.pdf
Is there any way to do that?
Thanks in advance for any help,
Mariusz
If you want to keep the original resolution (lossless) you can try the following command:
convert png.png -background white -page a4 myoutput.pdf
Based on a comment posted before: https://stackoverflow.com/a/24573341/6747994
#m4tx This command only makes sense if the picture has a resolution above 500x800px, it does not zoom in, to avoid pixelated thumbnails.
You can convert to pdf using ImageMagick
convert png.png myout.pdf
but use pdfjam instead of ImageMagick to adjust the page size
pdfjam --paper a4paper --outfile myoutA4.pdf myout.pdf
pdfjam offers other options, which may fit your needs.
Found this somewhere on stackoverflow:
convert *.jpg -resize 1240x1753 \
-extent 1240x1753 -gravity center \
-units PixelsPerInch -density 150x150 multipage.pdf
Thanks to the ImageMagick support forum I was able to find a solution:
convert image.tif -resize 575x823^> -gravity center -background white -extent 595x842 image.pdf
If you get an error try:
convert image.tif -resize 595x842^\> -gravity center -background white -extent 595x842 image.pdf
You need to specify the density:
convert -density 80 -page a4 input_A.jpg input_B.jpg output.pdf
Otherwise, there can be an issue when printing with "actual size" instead of "fit". I have used a public printer where I could not choose "fit" and had to choose "actual size", in which case the printed page was only a part of the page which I wanted to print.
I'm after a very specific conversion result from Imagemagick, taking something like this:
And converting it into something like this (1140 pixels wide, 12px border around the top, left, and right of the original):
So far I'm using this code to convert it:
convert nike.jpg -colorspace RGB -density 72 -gravity west -background white -extent 1140x104 nike2.jpg
But I'm getting this very skewed result:
Any advice on how to get closer to my goal here? I guess I'm trying to chain Imagemagick commands here to reduce the size to 78px high, add a 12px border, then extend the background on the right to 1140px wide, and I'm not really sure how to chain commands in Imagemagick via Paperclip.
Solved perfectly:
convert nike.jpg -colorspace RGB -density 72 -resize 78 -gravity west -bordercolor white -border 12x12 -background white -extent 1140x104 nike3.jpg