动画 gif_调整动画GIF的大小

动画 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.gif


You 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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值