MAC制作GIF及设置GIF循环播放

需求:在Mac电脑中录制操作,并生成GIF文件。GIF文件需要循环播放。

工具选择

安装Recordit,录制GIF图片

  • 下载最新版本,解压后直接运行
  • 点击Record,会提示选择录制范围
  • 选择范围后,再点击Recordit的图标,开始录制
  • 操作完成后,再点击Recordit的图标,录制结束

Recordit会将本次的录制内容上传至服务器,如果需要删除时,需要手动在Recordit中删除

使用gifsicle设置图片为循环播放

  • 下载gifsicle,gifsicle-1.88.tar.gz,解压
  • Terminal进入解压目录,运行./configure --disable-gifview --disable-gifdiff
➜  gifsicle-1.88 ./configure --disable-gifview --disable-gifdiff
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make sets $(MAKE)... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking for random... yes
checking for strerror... yes
checking for strtoul... yes
checking for mkstemp... yes
checking for library containing pow... none required
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking for inttypes.h... (cached) yes
checking for unistd.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for uintptr_t... yes
checking for int64_t... yes
checking size of unsigned int... 4
checking size of unsigned long... 8
checking size of void *... 8
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands
  • 执行make命令
➜  gifsicle-1.88 make
/Library/Developer/CommandLineTools/usr/bin/make  all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT clp.o -MD -MP -MF .deps/clp.Tpo -c -o clp.o clp.c
mv -f .deps/clp.Tpo .deps/clp.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT fmalloc.o -MD -MP -MF .deps/fmalloc.Tpo -c -o fmalloc.o fmalloc.c
mv -f .deps/fmalloc.Tpo .deps/fmalloc.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT giffunc.o -MD -MP -MF .deps/giffunc.Tpo -c -o giffunc.o giffunc.c
mv -f .deps/giffunc.Tpo .deps/giffunc.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT gifread.o -MD -MP -MF .deps/gifread.Tpo -c -o gifread.o gifread.c
mv -f .deps/gifread.Tpo .deps/gifread.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT gifunopt.o -MD -MP -MF .deps/gifunopt.Tpo -c -o gifunopt.o gifunopt.c
mv -f .deps/gifunopt.Tpo .deps/gifunopt.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT merge.o -MD -MP -MF .deps/merge.Tpo -c -o merge.o merge.c
mv -f .deps/merge.Tpo .deps/merge.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT optimize.o -MD -MP -MF .deps/optimize.Tpo -c -o optimize.o optimize.c
mv -f .deps/optimize.Tpo .deps/optimize.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT quantize.o -MD -MP -MF .deps/quantize.Tpo -c -o quantize.o quantize.c
mv -f .deps/quantize.Tpo .deps/quantize.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT support.o -MD -MP -MF .deps/support.Tpo -c -o support.o support.c
mv -f .deps/support.Tpo .deps/support.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT xform.o -MD -MP -MF .deps/xform.Tpo -c -o xform.o xform.c
mv -f .deps/xform.Tpo .deps/xform.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT gifsicle.o -MD -MP -MF .deps/gifsicle.Tpo -c -o gifsicle.o gifsicle.c
gifsicle.c:24:9: warning: 'static_assert' macro redefined [-Wmacro-redefined]
#define static_assert(x, msg) switch ((int) (x)) case 0: case !!((int) (x)):
        ^
/usr/include/assert.h:107:9: note: previous definition is here
#define static_assert _Static_assert
        ^
1 warning generated.
mv -f .deps/gifsicle.Tpo .deps/gifsicle.Po
gcc -DHAVE_CONFIG_H -I. -I..    -I../include   -g -O2 -MT gifwrite.o -MD -MP -MF .deps/gifwrite.Tpo -c -o gifwrite.o gifwrite.c
mv -f .deps/gifwrite.Tpo .deps/gifwrite.Po
gcc  -g -O2   -o gifsicle clp.o fmalloc.o giffunc.o gifread.o gifunopt.o merge.o optimize.o quantize.o support.o xform.o gifsicle.o  gifwrite.o
make[2]: Nothing to be done for `all-am'.
  • 进入src目录,将原GIf图片(目录:~/Documents/test.gif)设置为循环播放
➜  gifsicle-1.88 cd src
➜  src ./gifsicle -bl ~/Documents/test.gif

将GIF图片设置为循环播放已完成。

  • 其它gifsicle参数
'Gifsicle' manipulates GIF images. Its most common uses include combining
single images into animations, adding transparency, optimizing animations for
space, and printing information about GIFs.

Usage: gifsicle [OPTION | FILE | FRAME]...

Mode options: at most one, before any filenames.
  -m, --merge                   Merge mode: combine inputs, write stdout.
  -b, --batch                   Batch mode: modify inputs, write back to
                                same filenames.
  -e, --explode                 Explode mode: write N files for each input,
                                one per frame, to 'input.frame-number'.
  -E, --explode-by-name         Explode mode, but write 'input.name'.

General options: Also --no-OPTION for info and verbose.
  -I, --info                    Print info about input GIFs. Two -I's means
                                normal output is not suppressed.
      --color-info, --cinfo     --info plus colormap details.
      --extension-info, --xinfo --info plus extension details.
      --size-info, --sinfo      --info plus compression information.
  -V, --verbose                 Prints progress information.
  -h, --help                    Print this message and exit.
      --version                 Print version number and exit.
  -o, --output FILE             Write output to FILE.
  -w, --no-warnings             Don't report warnings.
      --no-ignore-errors        Quit on very erroneous input GIFs.
      --conserve-memory         Conserve memory at the expense of speed.
      --multifile               Support concatenated GIF files.

Frame selections:               #num, #num1-num2, #num1-, #name

Frame change options:
  --delete FRAMES               Delete FRAMES from input.
  --insert-before FRAME GIFS    Insert GIFS before FRAMES in input.
  --append GIFS                 Append GIFS to input.
  --replace FRAMES GIFS         Replace FRAMES with GIFS in input.
  --done                        Done with frame changes.

Image options: Also --no-OPTION and --same-OPTION.
  -B, --background COL          Make COL the background color.
      --crop X,Y+WxH, --crop X,Y-X2,Y2
                                Crop the image.
      --crop-transparency       Crop transparent borders off the image.
      --flip-horizontal, --flip-vertical
                                Flip the image.
  -i, --interlace               Turn on interlacing.
  -S, --logical-screen WxH      Set logical screen to WxH.
  -p, --position X,Y            Set frame position to (X,Y).
      --rotate-90, --rotate-180, --rotate-270, --no-rotate
                                Rotate the image.
  -t, --transparent COL         Make COL transparent.

Extension options:
      --app-extension N D       Add an app extension named N with data D.
  -c, --comment TEXT            Add a comment before the next frame.
      --extension N D           Add an extension number N with data D.
  -n, --name TEXT               Set next frame's name.
      --no-comments, --no-names, --no-extensions
                                Remove comments (names, extensions) from input.
Animation options: Also --no-OPTION and --same-OPTION.
  -d, --delay TIME              Set frame delay to TIME (in 1/100sec).
  -D, --disposal METHOD         Set frame disposal to METHOD.
  -l, --loopcount[=N]           Set loop extension to N (default forever).
  -O, --optimize[=LEVEL]        Optimize output GIFs.
  -U, --unoptimize              Unoptimize input GIFs.

Whole-GIF options: Also --no-OPTION.
      --careful                 Write larger GIFs that avoid bugs in other
                                programs.
      --change-color COL1 COL2  Change COL1 to COL2 throughout.
  -k, --colors N                Reduce the number of colors to N.
      --color-method METHOD     Set method for choosing reduced colors.
  -f, --dither                  Dither image after changing colormap.
      --gamma G                 Set gamma for color reduction [2.2].
      --resize WxH              Resize the output GIF to WxH.
      --resize-width W          Resize to width W and proportional height.
      --resize-height H         Resize to height H and proportional width.
      --resize-fit WxH          Resize if necessary to fit within WxH.
      --scale XFACTOR[xYFACTOR] Scale the output GIF by XFACTORxYFACTOR.
      --resize-method METHOD    Set resizing method.
      --resize-colors N         Resize can add new colors up to N.
      --transform-colormap CMD  Transform each output colormap by shell CMD.
      --use-colormap CMAP       Set output GIF's colormap to CMAP, which can
                                be 'web', 'gray', 'bw', or a GIF file.

总结

  • 使用MAC录制GIF图片,只需要Recordit就可以
  • 使用gifsicle处理图片
    • 将图片转为GIF
    • 处理GIF的机制,循环次数、设置大小、透明度等
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 158,847评论 4 362
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 67,208评论 1 292
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 108,587评论 0 243
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,942评论 0 205
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,332评论 3 287
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,587评论 1 218
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,853评论 2 312
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,568评论 0 198
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,273评论 1 242
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,542评论 2 246
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 32,033评论 1 260
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,373评论 2 253
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 33,031评论 3 236
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,073评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,830评论 0 195
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,628评论 2 274
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,537评论 2 269

推荐阅读更多精彩内容