GIF图像扭曲得到隔行上 [英] GIF Image getting distorted on interlacing

查看:259
本文介绍了GIF图像扭曲得到隔行上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

扭曲GIF

我有一个正在使用的 ImageMagick的及其交错操作转换一些图片。这些被动画 GIF 图片。问题是,在转换,图像扭曲,我没有与我的原始图像,因为它是previous开发谁做了美妙的事情。在 GIF 没有更多的动画,每帧有减小的尺寸相同帧的4份。我没有上过功夫的 ImageMagick的之前。

I have a few images that were converted using Imagemagick and its interlaced operation. These were the animated GIF images. The issue is that, while converting, the images have distorted and I do not have original images with me as it was the previous developer who did the wonderful thing. The GIF is no more animating and each frame has 4 copies of the same frame with decreasing sizes. I have not worked much on Imagemagick before.

有什么办法,我可以从扭曲的版本恢复到原来的形象呢?

Is there any way I can restore the original image from the distorted version?

使用的命令是:

转换<老file.gif中> -interlace平面<新file.gif中>

感谢

推荐答案

隔行GIF 影像被保存为4分离的图像

interlaced GIF images are stored as 4 separated images


  1. 包含图像的每个8号线(大小的1/8)

  2. 包含图像的每一个失踪4号线(大小的1/8)

  3. 包含每丢失甚至线图像的(大小的1/4)

  4. 包含图像的每一个奇数行(大小的1/2)

这是这样做的图像可以同时通过互联网连接速度较慢加载中可以看出...增加与每一个新块的详细信息...

This is done so the image can be seen while loading through slow Internet connection ... increasing details with every new chunk...

所以,如果你的图片看起来像4非常相似的图像,那么结果是OK,你只是错德code,或在GIF未设置交错标志​​。

如果您的文件不包含动画帧了,那么你的运气了,但如果他们在那里,而不是渲染然后检查文件的GIF到底是不是放错地方或检查他们可能搞砸了的标志......有你尝试过不同的GIF查看器(有些是越野车)

If your file does not contain the animation frames anymore then you are out of luck but if they are there and not rendering then check the GIF end of file is not misplaced or check the flags they could be screwed up... Have you tried different GIF viewer (some are buggy)

您的GIF解码后

您得到了在每帧中的的GIF89a 并你缺少交错标志。所以图像正确交错,但观众认为它没有交错在所有...你需要在每个帧头来标记交错标志。

You got GIF89a and you are missing interlaced flags in each frame. So the image is interlaced correctly but the viewer thinks it is not interlaced at all ... You need to mark interlaced flag in each frame header.

struct _img // this is image frame header
    {
    // Logical Image Descriptor
    BYTE Separator;         /* Image Descriptor identifier 0x2C */
    WORD x0;                /* X position of image on the display */
    WORD y0;                /* Y position of image on the display */
    WORD xs;                /* Width of the image in pixels */
    WORD ys;                /* Height of the image in pixels */
    BYTE Packed;            /* Image and Color Table Data Information */
    } img;

img.Packed|=64; // this will set the interlaced flag

要做到这一点,你需要去code /流复制GIF这并不容易,因为它的声音。

To do that you need to decode/stream copy the GIF which is not that easy as it sounds.

请参阅:

  • How to find where does Image Block start in GIF images?
  • Decode data bytes of GIF87a raster data stream

下面帧的结果复制+逐行扫描+交错带code(跳过控制/信息/辅助饲料...)

Here the result of frames copy + deinterlace + interlaced encode (skipping control/info/auxiliary feeds ...)

修复形象

这篇关于GIF图像扭曲得到隔行上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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