{"id":1733,"date":"2018-09-22T15:51:01","date_gmt":"2018-09-22T06:51:01","guid":{"rendered":"https:\/\/www.dogrow.net\/linux\/?p=1733"},"modified":"2019-11-07T00:38:17","modified_gmt":"2019-11-06T15:38:17","slug":"blog95","status":"publish","type":"post","link":"https:\/\/www.dogrow.net\/linux\/blog95\/","title":{"rendered":"(95) <span class=\"my_fc_deeppinkB\">convert<\/span>\u30b3\u30de\u30f3\u30c9\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3GIF\u4f5c\u6210"},"content":{"rendered":"<h1 class=\"my_h\">1. \u3084\u308a\u305f\u3044\u3053\u3068<\/h1>\n<p>ImageMagick\u306e <span class=\"my_fc_deeppink\">convert<\/span> \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3GIF\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u308a\u305f\u3044\u3002<\/p>\n<p>\u66f4\u306b&#8230;<br \/>\n\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3055\u305b\u308b\u753b\u50cf\u306f\u3001\u3053\u306e\u753b\u50cf\u306e\u5de6\u5074\u304b\u3089\u9806\u306b <span class=\"my_fc_deeppink\">convert<\/span>\u30b3\u30de\u30f3\u30c9\u3067\u77e9\u5f62\u3092\u5207\u308a\u51fa\u3057\u3066\u4f5c\u308a\u305f\u3044\u3002<\/p>\n<p><b>bg.png 1000&#215;64[pixel]<\/b><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/bg.png\" alt=\"\" \/><\/p>\n<h1 class=\"my_h\">2. \u3084\u3063\u3066\u307f\u308b<\/h1>\n<h2 class=\"my_h\">(1) \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u4f7f\u3046\u753b\u50cf\u306e\u5207\u308a\u51fa\u3057\u3002<\/h2>\n<p>\u4e0a\u8a18\u306e\u6a2a\u9577\u753b\u50cf\u306e\u5de6\u7aef\u304b\u3089\u9806\u306b\u30012\u30d4\u30af\u30bb\u30eb\u305a\u3064\u53f3\u306b\u79fb\u52d5\u3057\u306a\u304c\u3089 120 x 64[pixel]\u306e\u753b\u50cf\u3092 442\u679a\u5207\u308a\u51fa\u3059\u3002<br \/>\n<span class=\"my_fc_deeppink\">-crop<\/span> : {WIDTH}x{HEIGHT}+{OFFSET_X}+{OFFSET_Y}<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nfor I in `seq 0 2 880`;do\r\n    NUM=`printf &quot;%04d&quot; $I`\r\n    FNAME=&quot;bg_${NUM}.gif&quot;\r\n    convert bg.png -crop 120x64+${NUM}+0 +repage $FNAME\r\ndone\r\n<\/pre>\n<p>\u3053\u3053\u3067 <span class=\"my_fc_deeppink\">+repage<\/span> \u306f\u5207\u308a\u51fa\u3057\u305f\u753b\u50cf\u3092\u30c8\u30ea\u30df\u30f3\u30b0\u3059\u308b\u305f\u3081\u306b\u6307\u5b9a\u3059\u308b\u3002<br \/>\n\u3053\u308c\u3092\u6307\u5b9a\u3057\u306a\u3044\u3068\u3001\u3053\u3093\u306a\u30b3\u30de\u753b\u50cf\u304c\u51fa\u6765\u3066\u3057\u307e\u3046\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/bg_0426.gif\" alt=\"\" style=\"border:1px #000 solid;\"\/><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/bg_0396.gif\" alt=\"\" style=\"border:1px #000 solid;\"\/><br \/>\n<span class=\"my_fc_crimson\">\u203b\u30c8\u30ea\u30df\u30f3\u30b0\u3055\u308c\u3066\u3044\u306a\u3044\u3053\u3068\u304c\u308f\u304b\u308b\u3088\u3046\u306b\u3001\u753b\u50cf\u306e\u5468\u56f2\u3092\u9ed2\u7dda\u3067\u56f2\u3093\u3067\u3044\u308b\u3002<\/span><\/p>\n<h2 class=\"my_h\">(2) \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3GIF\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u308b\u3002<\/h2>\n<p><span class=\"my_fc_deeppink\">-delay 5<\/span> : 1\u30b3\u30de 50ms, \u3059\u306a\u308f\u3061 20fps\u306e\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3GIF\u3068\u3059\u308b\u3002<br \/>\n<span class=\"my_fc_deeppink\">-loop 0<\/span> : \u7121\u9650\u518d\u751f\u3055\u305b\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nconvert -delay 5 -loop 0 bg_*.gif anim.gif\r\n<\/pre>\n<p><span class=\"my_fc_crimson\">\u203bWEB\u30d6\u30e9\u30a6\u30b6\u304a\u3088\u3073\u305d\u306e\u5b9f\u884c\u74b0\u5883\u306b\u3088\u308a 20fps\u306f\u51fa\u306a\u3044\u304b\u3082&#8230;<\/span><\/p>\n<p>\u3067\u304d\u3042\u304c\u3063\u305f\u306e\u304c\u3053\u3061\u3089\uff01<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/anim.gif\" alt=\"\" class=\"my_add_bs1\" \/><\/p>\n<p>\u56e0\u307f\u306b&#8230;<br \/>\n<span class=\"my_fc_deeppink\">+repage<\/span> \u3067\u30c8\u30ea\u30df\u30f3\u30b0\u6307\u5b9a\u3057\u306a\u3044\u3068\u3053\u3093\u306a\u30a2\u30cb\u30e1\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/anim_notrim.gif\" alt=\"\" class=\"my_add_bs1\" \/><\/p>\n<h1 class=\"my_h\">3. \u5fdc\u7528<\/h1>\n<h2 class=\"my_h\">(1) \u30a2\u30cb\u30e1\u306e\u5404\u30b3\u30de\u306b\u5225\u753b\u50cf\u3092\u91cd\u306d\u5408\u308f\u305b\u308b\u3002<\/h2>\n<p>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u5404\u30b3\u30de\u306b\u306f\u3001\u7a7a\u98db\u3076\u7269\u4f53\u3082\u91cd\u306d\u3066\u8868\u793a\u3057\u305f\u3044\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/obj.png\" alt=\"\" \/><\/p>\n<p>\u4e0a\u8a18 2.(1) \u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5909\u66f4\u3059\u308b\u3002 5\u884c\u76ee\u3092\u8ffd\u52a0\u3057\u305f\u3060\u3051\u3002<\/p>\n<pre class=\"brush: bash; highlight: [5]; title: ; notranslate\" title=\"\">\r\nfor I in `seq 0 2 880`;do\r\n    NUM=`printf &quot;%04d&quot; $I`\r\n    FNAME=&quot;bg_${NUM}.gif&quot;\r\n    convert bg.png -crop 120x64+${NUM}+0 +repage $FNAME\r\n    convert $FNAME obj.png -gravity center -compose over -composite $FNAME\r\ndone\r\n\r\nconvert -delay 5 -loop 0 bg_*.gif anim2.gif\r\n<\/pre>\n<p>\u3067\u304d\u3042\u304c\u3063\u305f\u306e\u304c\u3053\u3061\u3089\uff01<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/anim2.gif\" alt=\"\" \/><\/p>\n<h2 class=\"my_h\">(2) \u7a7a\u98db\u3076\u7269\u4f53\u3092\u63fa\u3089\u3057\u3066\u307f\u308b\u3002<\/h2>\n<p>-3\u5ea6\u304b\u3089 +3\u5ea6\u307e\u3067\u30011\u5ea6\u523b\u307f\u3067 7\u6bb5\u968e\u306b\u56de\u8ee2\u3055\u305b\u3066\u63fa\u3089\u3057\u3066\u307f\u308b\u3002<\/p>\n<p>\u307e\u305a\u306f\u7a7a\u98db\u3076\u7269\u4f53\u304c\u63fa\u308c\u305f\u3068\u304d\u306e\u753b\u50cf\u3092\u4f5c\u6210\u3057\u3066\u304a\u304f\u3002<br \/>\n\u30fb2\u884c\u76ee : <span class=\"my_fc_deeppink\">${#angle[*]}<\/span> \u914d\u5217\u306e\u8981\u7d20\u6570\u3092\u53d6\u5f97\u3059\u308b\u3002<br \/>\n\u30fb5\u884c\u76ee : <span class=\"my_fc_deeppink\">-background<\/span> \u56de\u8ee2\u5f8c\u306b\u751f\u3058\u305f\u9818\u57df\u306f\u900f\u904e\u8272\u3068\u3059\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nangle=(0 1 2 3 2 1 0 -1 -2 -3 -2 -1)\r\nNUMANG=${#angle&#x5B;*]}    # \u914d\u5217\u306e\u8981\u7d20\u6570\r\nfor ANG in ${angle&#x5B;@]}; do\r\n    OBJIMG=&quot;obj_ang${ANG}.png&quot;\r\n    convert obj.png -background 'rgba(0,0,0,0)' -rotate $ANG $OBJIMG\r\ndone\r\n<\/pre>\n<p>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u4f5c\u6210\u6642\u3001\u7a7a\u98db\u3076\u7269\u4f53\u306e\u56de\u8ee2\u89d2\u5ea6\u3092 1\u30b3\u30de\u305a\u3064\u5909\u3048\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nfor I in `seq 0 440`;do\r\n    FNAME=`printf &quot;bg_%04d.gif&quot; $I`\r\n    X=$(($I * 2))\r\n    convert bg.png -crop 120x64+${X}+0 +repage $FNAME\r\n\r\n    MOD=$(($I % $NUMANG))\r\n    OBJIMG=&quot;obj_ang${angle&#x5B;${MOD}]}.png&quot;\r\n    convert $FNAME $OBJIMG -gravity center -compose over -composite $FNAME\r\ndone\r\n\r\nconvert -delay 5 -loop 0 bg_*.gif anim3.gif\r\n<\/pre>\n<p>\u3067\u304d\u3042\u304c\u3063\u305f\u306e\u304c\u3053\u3061\u3089\uff01<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/anim3.gif\" alt=\"\" \/><\/p>\n<h2 class=\"my_h\">(3) \u7a7a\u98db\u3076\u7269\u4f53\u306e\u5927\u304d\u3055\u3092\u5909\u3048\u3066\u307f\u308b\u3002<\/h2>\n<p>100%\u304b\u3089 94%\u307e\u3067 7\u6bb5\u968e\u306b\u5927\u304d\u3055\u3092\u5909\u3048\u3066\u307f\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n# \u7a7a\u98db\u3076\u7269\u4f53\u306e\u56de\u8ee2\u89d2\u5ea6\u3092\u5909\u3048\u305f\u753b\u50cf\u3092\u4f5c\u6210\u3057\u3066\u304a\u304f\u3002\r\nangle=(0 1 2 3 2 1 0 -1 -2 -3 -2 -1)\r\nsize=(100% 99% 98% 97% 96% 95% 94% 95% 96% 97% 98% 99%)\r\nNUMANG=${#angle&#x5B;*]}\r\n\r\nI=0\r\nfor ANG in ${angle&#x5B;@]}; do\r\n    OBJIMG=&quot;obj_ang${I}.png&quot;\r\n    convert obj.png -background 'rgba(0,0,0,0)' -resize ${size&#x5B;$I]} -rotate $ANG $OBJIMG\r\n    I=`expr $I + 1`\r\ndone\r\n\r\n# \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u30b3\u30de\u753b\u50cf\u3092\u4f5c\u6210\u3059\u308b\u3002\r\nfor I in `seq 0 440`;do\r\n    FNAME=`printf &quot;bg_%04d.gif&quot; $I`\r\n    X=$(($I * 2))\r\n    convert bg.png -crop 120x64+${X}+0 +repage $FNAME\r\n\r\n    MOD=$(($I % $NUMANG))\r\n    OBJIMG=&quot;obj_ang${MOD}.png&quot;\r\n    convert $FNAME $OBJIMG -gravity center -compose over -composite $FNAME\r\ndone\r\n\r\nconvert -delay 5 -loop 0 bg_*.gif anim4.gif\r\n<\/pre>\n<p>\u3067\u304d\u3042\u304c\u3063\u305f\u306e\u304c\u3053\u3061\u3089\uff01<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/anim4.gif\" alt=\"\" \/><\/p>\n<h2 class=\"my_h\">(4) \u30b9\u30af\u30ed\u30fc\u30eb\u65b9\u5411\u3092\u53cd\u8ee2\u3055\u305b\u3066\u307f\u308b\u3002<\/h2>\n<p>\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u4f7f\u3046\u753b\u50cf\u3092\u53cd\u8ee2\u3055\u305b\u308b\u3053\u3068\u306b\u3088\u308a\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u306e\u5411\u304d\u3092\u53cd\u5bfe\u306b\u3059\u308b\u3002<\/p>\n<p>\u4e0a\u8a18(3)\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3GIF\u3092\u4f5c\u6210\u3059\u308b\u76f4\u524d\u306b\u5168\u30b3\u30de\u753b\u50cf\u3092\u5de6\u53f3\u53cd\u8ee2\u3055\u305b\u308b\u3002<br \/>\n\u500b\u3005\u306e\u753b\u50cf\u3092\u51e6\u7406\u3059\u308b <span class=\"my_fc_deeppink\">convert<\/span> \u306b\u5bfe\u3057\u3066 <span class=\"my_fc_deeppink\">mogrify<\/span> \u306f\u8907\u6570\u753b\u50cf\u3092\u307e\u3068\u3081\u3066\u51e6\u7406\u3067\u304d\u308b\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmogrify -flop bg_*.gif\r\n\r\nconvert -delay 5 -loop 0 bg_*.gif anim5.gif\r\n<\/pre>\n<p>\u3067\u304d\u3042\u304c\u3063\u305f\u306e\u304c\u3053\u3061\u3089\uff01<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.dogrow.net\/linux\/wp-content\/uploads\/2018\/09\/anim5.gif\" alt=\"\" \/><\/p>\n<h1 class=\"my_h\">4. \u53c2\u8003\u60c5\u5831<\/h1>\n<p>\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u3002 m(_ _)m<br \/>\n<a href=\"https:\/\/shellscript.sunone.me\/array.html#%E9%85%8D%E5%88%97%E3%81%AE%E8%A6%81%E7%B4%A0%E6%95%B0%E3%82%92%E5%8F%82%E7%85%A7%E3%81%99%E3%82%8B\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/shellscript.sunone.me\/array.html#%E9%85%8D%E5%88%97%E3%81%AE%E8%A6%81%E7%B4%A0%E6%95%B0%E3%82%92%E5%8F%82%E7%85%A7%E3%81%99%E3%82%8B<\/a><\/p>\n<hr class=\"my_hr_bottom\">\n","protected":false},"excerpt":{"rendered":"<p>1. \u3084\u308a\u305f\u3044\u3053\u3068 ImageMagick\u306e convert \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3GIF\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u308a\u305f\u3044\u3002 \u66f4\u306b&#8230; \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3055\u305b\u308b\u753b\u50cf\u306f\u3001\u3053\u306e\u753b\u50cf\u306e\u5de6\u5074\u304b\u3089\u9806\u306b convert\u30b3\u30de\u30f3\u30c9\u3067\u77e9\u5f62\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.dogrow.net\/linux\/blog95\/\">\u7d9a\u304d\u3092\u8aad\u3080 &raquo;<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[],"class_list":["post-1733","post","type-post","status-publish","format-standard","hentry","category-convert"],"views":7305,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/posts\/1733","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/comments?post=1733"}],"version-history":[{"count":31,"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/posts\/1733\/revisions"}],"predecessor-version":[{"id":2521,"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/posts\/1733\/revisions\/2521"}],"wp:attachment":[{"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/media?parent=1733"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/categories?post=1733"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dogrow.net\/linux\/wp-json\/wp\/v2\/tags?post=1733"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}