首页 > 其他分享 >imagemagick: 对损坏的gif图做拆分(ImageMagick 6.9.10)

imagemagick: 对损坏的gif图做拆分(ImageMagick 6.9.10)

时间:2022-10-19 11:23:55浏览次数:72  
标签:10 imagemagick gif GIF sRGB bit maoshu 0.000

一,对正常的gif图拆分:

[lhdop@blog img2]$ identify maoshu.gif
maoshu.gif[0] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[1] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[2] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[3] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[4] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[5] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[6] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[7] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[8] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[9] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[10] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[11] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[12] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[13] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[14] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[15] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[16] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[17] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[18] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[19] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[20] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[21] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[22] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[23] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[24] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[25] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[26] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[27] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[28] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.001
maoshu.gif[29] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.000
maoshu.gif[30] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.000
maoshu.gif[31] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.000
maoshu.gif[32] GIF 400x224 400x224+0+0 8-bit sRGB 256c 0.000u 0:00.000
maoshu.gif[33] GIF 400x224 400x224+0+0 8-bit sRGB 256c 1.84787MiB 0.000u 0:00.000
[lhdop@blog img2]$ convert maoshu.gif maoshu.png
[lhdop@blog img2]$ ls
a.jpeg     maoshu-0.png   maoshu-13.png  maoshu-17.png  maoshu-20.png  maoshu-24.png  maoshu-28.png  maoshu-31.png  maoshu-4.png  maoshu-8.png  yz.gif
b.png      maoshu-10.png  maoshu-14.png  maoshu-18.png  maoshu-21.png  maoshu-25.png  maoshu-29.png  maoshu-32.png  maoshu-5.png  maoshu-9.png
dog49.png  maoshu-11.png  maoshu-15.png  maoshu-19.png  maoshu-22.png  maoshu-26.png  maoshu-2.png   maoshu-33.png  maoshu-6.png  maoshu.gif
dog.gif    maoshu-12.png  maoshu-16.png  maoshu-1.png   maoshu-23.png  maoshu-27.png  maoshu-30.png  maoshu-3.png   maoshu-7.png  red.png

说明:对图片做identify时没有报错表示图片没有损坏

说明:convert时会用gif文件名加-帧数做为文件名

gif图:

 

提取的第9帧

 

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/
         或: https://gitee.com/liuhongdi

说明:作者:刘宏缔 邮箱: [email protected]

二,处理损坏的gif

1,convert时报错

[lhdop@blog img2]$ convert dog.gif dog.png
convert: corrupt image `dog.gif' @ error/gif.c/DecodeImage/513.
convert: corrupt image `dog.gif' @ error/gif.c/ReadGIFImage/1389.
convert: no images defined `dog.png' @ error/convert.c/ConvertImageCommand/3226.

用identify查看:

[lhdop@blog img2]$ identify dog.gif
dog.gif[0] GIF 250x250 250x250+0+0 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[1] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[2] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[3] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[4] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[5] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[6] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[7] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[8] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[9] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[10] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[11] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[12] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[13] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[14] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[15] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[16] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[17] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[18] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[19] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[20] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[21] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[22] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[23] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[24] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[25] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[26] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[27] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[28] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[29] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[30] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[31] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[32] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[33] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[34] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[35] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[36] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[37] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[38] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[39] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[40] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[41] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[42] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[43] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[44] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[45] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[46] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[47] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[48] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[49] GIF 248x248 250x250+1+1 8-bit sRGB 32c 0.000u 0:00.002
dog.gif[50] GIF 248x248 250x250+1+1 8-bit sRGB 32c 901120B 0.000u 0:00.002
identify: corrupt image `dog.gif' @ error/gif.c/PingGIFImage/965.

用identify查看时有corrupt报错提示

2,解决:

可以逐帧提取:

[lhdop@blog img2]$ convert dog.gif[49] dog-49.png
[lhdop@blog img2]$ ls
a.jpeg  b.png  dog-49.png  dog49.png  dog.gif  maoshu.gif  red.png  yz.gif
[lhdop@blog img2]$ convert dog.gif[50] dog-50.png
convert: corrupt image `dog.gif' @ error/gif.c/DecodeImage/513.
convert: corrupt image `dog.gif' @ error/gif.c/ReadGIFImage/1389.
convert: no images defined `dog-50.png' @ error/convert.c/ConvertImageCommand/3226.

3,例子中用到gif图:

 

提取的第49帧

 

三,查看imagemagick的版本:

[lhdop@blog img]$ convert -version
Version: ImageMagick 6.9.10-86 Q16 x86_64 2020-01-13 https://imagemagick.org
Copyright: © 1999-2020 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(4.5)
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib gvc jbig jng jp2 
jpeg lcms ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib 

 

标签:10,imagemagick,gif,GIF,sRGB,bit,maoshu,0.000
From: https://www.cnblogs.com/architectforest/p/16805563.html

相关文章

  • 10.19
    Markdown学习标题三级标题四级标题字体Hello,World!Hello,World!Hello,World!Hello,World!引用选择狂神说Java,走向人生巅峰分割线图片![截图](C:\Users\Fhy0303\P......
  • 【2022.10.19】Linux(2)
    学习内容1.虚拟机关键配置名词解释2.远程连接工具3.xshell基本使用4.linux命令准则5.系统运行命令6.常用快捷方式7.文件命令操作8.快照功能9.文件编辑命令10.......
  • 驱动开发:Win10内核枚举SSDT表基址
    三年前面朝黄土背朝天的我,写了一篇如何在Windows7系统下枚举内核SSDT表的文章《驱动开发:内核读取SSDT表基址》三年过去了我还是个单身狗,开个玩笑,微软的Windows10系统已经......
  • 国外大神制作的史上最精简Win10系统,真有那么好用吗?
    2020年,随着Windows7的落幕,这款延续了10多年,曾经辉煌一时,承载着许多人经典回忆的老版系统最终走向了终点。Win10是继Win7之后,在用户量和评价上,能够和Win7并驾齐......
  • 2022/10/19 分享七要素
    1、开场破冰(用好奇破抗拒)2、一个主题(重点)/次,一旦贪心,观点一多就会乱。(用内容破抗拒)3、分享不是讲过程而是讲故事,要为解决具体问题。(用故事破抗拒)4、分享必须让对方对号......
  • 驱动开发:Win10内核枚举SSDT表基址
    三年前面朝黄土背朝天的我,写了一篇如何在Windows7系统下枚举内核SSDT表的文章《驱动开发:内核读取SSDT表基址》三年过去了我还是个单身狗,开个玩笑,微软的Windows10系统已经......
  • 【2022-10-14】书,得好好读
    20:00要正直地生活,别想入非非,要诚实地工作,才能前程远大。                                  ......
  • 10.19
    你不耽误她别人也会耽误她不如让她在你身边你好好保护她我后来想了想,我不想耽误你但还会有别人耽误你那样我不甘心还是我来耽误你吧!其实我们不怕失去,只怕没有更好......
  • NRF 52810 beacon app 添加DFU 烧写固件失败
    Parsinghexfile.ERROR:Thefilespecifiedisnotavalidhexfile,hasdataoutsidevalidareasERROR:ordoesnothavedatainvalidareas.固件有问题可以在......
  • MySQL 错误码: 1067Invalid default value for ‘xxx‘问题解决
    声明,此文为转载内容,原作者地址为:https://blog.csdn.net/qq_38974638/article/details/1223005381.问题描述:错误码:1067Invaliddefaultvaluefor'gmt_create......