PLS HELP:How to compress a GIF with IM?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
eric_sun
Posts: 2
Joined: 2015-10-20T01:45:16-07:00
Authentication code: 1151

PLS HELP:How to compress a GIF with IM?

Post by eric_sun »

ORIG GIF:
Image

I have lots of such gif but their are very *fat* so I want to compress them, I got this method:
http://www.imagemagick.org/Usage/anim_opt/#opt_trans

I want to get the result with this example
ForImage
it have the frames:
Image
Step1: cut out same pixels for frames except frame 0, with Frame Optimized , Overlay Animation to generate this result:
Image

Code: Select all

//how to use IM parameters to get this result?
Step2: "-layers", method 'OptimizeTransparency' to get the result:
Image

Code: Select all

convert bunny_bgnd.gif -layers OptimizeTransparency \
                                    +map   bunny_bgnd_opttrans.gif
  gif_anim_montage bunny_bgnd_opttrans.gif bunny_bgnd_opttrans_frames.gif

PROBLEMES:
1,with Step 1, how to write IM command to produce Frame Optimized and Overlay Animation ?
2,with Step 2,the command"gif_anim_montage" does not exist in my OSX terminal. while I go the scripts http://www.imagemagick.org/Usage/script ... im_montage and save it as gif_anim_montage and chmod +x gif_anim_montage, and then run it with ./gif_anim_montage , I got this errors:

Code: Select all

localhost:Downloads ysun$ gif_anim_montage bunny_bgnd_opttrans.gif bunny_bgnd_opttrans_frames.gif
-bash: gif_anim_montage: command not found
localhost:Downloads ysun$ ./gif_anim_montage bunny_bgnd_opttrans.gif bunny_bgnd_opttrans_frames.gif
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-33592bkxmVfZM3H2X': No such file or directory @ error/ps.c/ReadPSImage/833.
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-33592pC0APA5oc1rl': No such file or directory @ error/ps.c/ReadPSImage/833.
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-33592yQY9PdEn1pkb': No such file or directory @ error/ps.c/ReadPSImage/833.
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-33592eq4qqx7N8h5I': No such file or directory @ error/ps.c/ReadPSImage/833.
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-33592kH2EU7S5pWdO': No such file or directory @ error/ps.c/ReadPSImage/833.
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-33592nC-CArZLgak8': No such file or directory @ error/ps.c/ReadPSImage/833.
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-335922uY0p_bUxju0': No such file or directory @ error/ps.c/ReadPSImage/833.
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-33592VUDbzUn9PM6v': No such file or directory @ error/ps.c/ReadPSImage/833.
montage: unable to read font `/usr/local/share/ghostscript/fonts/n019003l.pfb' @ error/annotate.c/RenderFreetype/1125.
montage: Postscript delegate failed `/var/tmp/magick-335928HfOLqRegshl': No such file or directory @ error/ps.c/ReadPSImage/833.
localhost:Downloads ysun$
Thanks very much for your help!
eric_sun
Posts: 2
Joined: 2015-10-20T01:45:16-07:00
Authentication code: 1151

Re: PLS HELP:How to compress a GIF with IM?

Post by eric_sun »

I got a solution with gifsicle:

1,got first frame

Code: Select all

 gifsicle GIF.gif "#0" -o frame.gif
2,crop the frames with animation area except frame 0

Code: Select all

  gifsicle -b -O2 --crop 245,80-329,172  -i GIF.gif '#1-' -o 2.gif
3,merge fame0 and the gif

Code: Select all

  gifsicle frame0.gif  -p245,80 2.gif -o resutl.gif 
and the result gif is:[350k]
Image

ORIG:[3.6M]
Image

from 3.6M to 350K
Post Reply