imagemagick将gif中的工件留给jpg列表转换 [英] imagemagick leaves artifacts in gif to jpg list conversion

查看:218
本文介绍了imagemagick将gif中的工件留给jpg列表转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ImageMagick将gif拆分为jpgs,但其中一些有白色像素而其他则没有。

ImageMagick splits the gif into jpgs but some of them have white pixels and others do not.

convert -strip tree.gif tree.jpg

将gif拆分为86 jpgs。这是#68和#69。

Splits the gif into 86 jpgs. Here are #68 and #69.

#68

和#69

和有问题的GIF:

约1/3有类似的编码问题。

about 1/3 have a similar encoding issue.

convert -version
Version: ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP   

uname -a
Linux paul-Pangolin-Performance 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux


推荐答案

在动画GIF图像中,每个新帧都绘制在前一帧的顶部,这意味着任何与前一帧相同的像素都可以用透明像素表示。 (实际上,这仅适用于Dispose None动画,但这就是你在这里所拥有的。请参见此处有关三种处理方法的详细信息。)

In animated GIF images, each new frame is drawn on top of the previous one, which means any pixels that are identical to the previous frame can be represented by transparent pixels. (Actually, this is only true for "Dispose None" animations, but that's what you have here. See here for details on the three kinds of disposal methods.)

动画GIF优化工具利用这一点,通过查找可以转换为透明的长像素像素(所以然后可以更有效地压缩它们)。因此,这就是原始图像中可能有透明像素的原因。

Animated GIF optimizer tools take advantage of this, by looking for long runs of pixels that can be converted to transparent (so they can then be compressed more efficiently). So, that's why you probably have transparent pixels in the original image.

当这些帧转换为JPG时,透明像素将转换为背景颜色白色。

When those frames are converted to JPG, the transparent pixels are being converted to the background color, white.

有关如何使用的说明,请参见此处修复它 - 您首先想要将叠加动画转换为合并动画,然后您可以将其转换为一系列JPG文件。它看起来像这样:

See here for a description of how to fix it—you first want to convert your "Overlay Animation" into a "Coalesced Animation", and then you can convert that to a series of JPG files. It should look something like this:

convert tree.gif -coalesce -set dispose previous tree2.gif

然后验证动画看起来是否相同,然后:

Then verify that the animation looks identical, and then:

convert -strip tree2.gif tree.jpg

我还没有查看了从那里链接的 gif_anim_montage 脚本,它生成了所有漂亮的逐帧图像。我猜它会有效地做同样的事情(加上更多的东西),但也许它有一些巧妙的技巧可以帮助你,所以我来看看。

I haven't looked at the gif_anim_montage script linked from there that generated all the nice frame-by-frame images. I'm guessing it'll be doing effectively the same thing (plus more stuff), but maybe it has some neat tricks that will help you out, so I'd take a look.

PS,你确定你想要JPG输出而不是PNG,甚至是GIF吗? JPG保证质量下降,而PNG保证不会。并且,考虑到源数据(256色GIF图像),PNG可能至少压缩,甚至更好。一个快速测试显示它是1980K与1916K的默认设置,并且通过一些微不足道的优化,PNG降至1888K。

PS, are you sure you want JPG output instead of, say, PNG, or even GIF? JPG is guaranteed to lose quality, while PNG is guaranteed not to. And, given the source data (256-color GIF images), PNG is likely to compress at least as well, or even better. A quick test shows it's 1980K vs. 1916K with the default settings, and with some trivial optimizing the PNGs come down to 1888K.

这篇关于imagemagick将gif中的工件留给jpg列表转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆