动画 gif
Animated GIFs are images but you can't really handle them link other types of images, like PNGs or JPEGs or even WebPs. GIFs are kind of a video file, because they have frames, but there's no real control over how they play or loop. My favorite image manipulation utility, ImageMagick, doesn't seem to be the best utility for animated GIFs -- another utility called gifsicle is as good as it gets. I showed you how to merge and optimize animated GIFs with gifsicle, and now let's look at resizing animated GIFs.
动画GIF是图像,但是您无法真正处理它们,将其他类型的图像链接在一起,例如PNG或JPEG甚至是WebP 。 GIF有点像视频文件,因为它们具有帧,但是无法真正控制它们的播放或循环。 我最喜欢的图像处理实用程序ImageMagick似乎不是动画GIF的最佳实用程序-另一个叫做gifsicle的实用程序就可以了。 我向您展示了如何与gifsicle 合并和优化动画GIF ,现在让我们看看调整动画GIF的大小。
If you try to use ImageMagick's basic resize functionality, you'll end up getting the first frame output to the correct size. That's nice but you want to keep the GIF animated, right? Here are a few easy methods for resizing a GIF with gifsicle:
如果尝试使用ImageMagick的基本尺寸调整功能,最终将使第一帧输出为正确的尺寸。 很好,但是您想让GIF保持动画,对不对? 以下是一些通过gifsicle调整GIF大小的简单方法:
# Scaling of an image - 50% gifsicle --scale 0.5 -i animation.gif > animation-smaller.gif # Scale to a given width with unspecified height gifsicle --resize-fit-width 300 -i animation.gif > animation-300px.gif # Scale to a given height with unspecified width gifsicle --resize-fit-height 100 -i animation.gif > animation-100px.gif # Clip to size gifsicle --resize 300x200 -i animation.gif > animation-clipped.gifYou can use scale to easily scale an image by a given factor, but you can also use --resize-fit-height or --resize-fit-width to scale to respective sizes. You can also clip with --resize. The output stays animated and you have your animated GIF at the desired size!
您可以使用scale轻松按给定的因子缩放图像,但是也可以使用--resize-fit-height或--resize-fit-width缩放为各自的大小。 您也可以使用--resize剪辑。 输出保持动画,并且您的动画GIF达到所需的大小!
翻译自: https://davidwalsh.name/resize-animated-gif
动画 gif