{"id":5249,"date":"2012-10-03T15:59:38","date_gmt":"2012-10-03T06:59:38","guid":{"rendered":"http:\/\/labs.gree.jp\/blog\/?p=5249"},"modified":"2021-04-27T15:03:49","modified_gmt":"2021-04-27T06:03:49","slug":"post5249","status":"publish","type":"post","link":"https:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/","title":{"rendered":"ImageMagick \u6539\u9020\u5165\u9580 (\u305d\u306e\u53c2) \u6e1b\u8272\u51e6\u7406\u5f8c\u7de8"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u57fa\u76e4\u30c1\u30fc\u30e0\u306e\u3088\u3084\u3067\u3059\u3002<\/p>\n<p>\u6e1b\u8272\u51e6\u7406\u306e\u8a71\u306e\u7d9a\u304d\u3067\u3001ImageMagick \u306e\u6539\u9020\u306b\u3064\u3044\u3066\u304a\u8a71\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li> \u524d\u56de > <a href=\"http:\/\/labs.gree.jp\/blog\/2012\/09\/4824\/\"> ImageMagick \u6539\u9020\u5165\u9580 (\u305d\u306e\u5f10) \u6e1b\u8272\u51e6\u7406\u524d\u7de8 <\/a><\/li>\n<\/ul>\n<p>ImageMagick \u6e1b\u8272\u51e6\u7406\u306e\uff13\u3064\u306e\u30d5\u30a7\u30fc\u30ba\u306e\u3046\u3061\uff12\u3064\u76ee\u306b\u3042\u305f\u308b\u300cRGB \u7a7a\u9593\u3067\u5206\u5272\u3055\u308c\u305f\u7acb\u65b9\u4f53\u306e\u7d71\u5408\u51e6\u7406\u300d\u3067\u7279\u306b\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3044\u305f\u306e\u3067\u3001\u5c11\u3057\u624b\u3092\u52a0\u3048\u3066\u9ad8\u901f\u5316\u3057\u307e\u3057\u305f\u3002<br \/>\n\u524d\u56de\u306e\u3053\u306e\u56f3\u306b\u76f8\u5f53\u3059\u308b\u51e6\u7406\u3067\u3059\u3002<br \/>\n<center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/09\/4824\/rgb-prune1\/\" rel=\"attachment wp-att-5528\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/09\/rgb-prune1-276x149.png\" alt=\"\" title=\"rgb-prune1\" width=\"276\" height=\"149\" class=\"aligncenter size-thumbnail wp-image-5528\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/09\/rgb-prune1-276x149.png 276w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/09\/rgb-prune1.png 520w\" sizes=\"auto, (max-width: 276px) 100vw, 276px\" \/><\/a><a href=\"http:\/\/labs.gree.jp\/blog\/2012\/09\/4824\/rgb-prune2\/\" rel=\"attachment wp-att-5529\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/09\/rgb-prune2-276x146.png\" alt=\"\" title=\"rgb-prune2\" width=\"276\" height=\"146\" class=\"aligncenter size-thumbnail wp-image-5529\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/09\/rgb-prune2-276x146.png 276w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/09\/rgb-prune2.png 509w\" sizes=\"auto, (max-width: 276px) 100vw, 276px\" \/><\/a><br \/>\n<\/center><\/p>\n<h3 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_0\"> ImageMagick \u306e\u65e2\u5b58\u306e\u51e6\u7406<\/h3>\n<p>\u524d\u56de\u3001\u8aac\u660e\u3057\u305f\u300cRGB \u7a7a\u9593\u3067\u5206\u5272\u3055\u308c\u305f\u7acb\u65b9\u4f53\u306e\u7d71\u5408\u51e6\u7406\u300d\u306e\u3088\u308a\u7d30\u304b\u3044\u89e3\u8aac\u3067\u3059\u3002<\/p>\n<h4 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_1\"> \u7d71\u5408\u51e6\u7406\u306e\u8a73\u7d30<\/h4>\n<p>\u65e2\u5b58\u306e ImageMagick \u306e\u6e1b\u8272\u51e6\u7406\u3067\u306f\u3001quantize_error \u306e\u5c0f\u3055\u3044\u9806\u306bRGB\u8272\u7a7a\u9593\u5185\u306e\u7acb\u65b9\u4f53\u3092\u524a\u9664\u3057\u3066\u3001\u305d\u308c\u3089\u306e\u3072\u3068\u3064\u89aa\u306e\u7acb\u65b9\u4f53\u306b\u7d71\u5408\u3059\u308b\u51e6\u7406\u3092\u7e70\u308a\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>\n \u5bfe\u5fdc\u30b3\u30fc\u30c9 (magick\/quantize.c)<\/p>\n<ul>\n<li>  \u671b\u307f\u306e\u8272\u6570\u306b\u306a\u308b\u307e\u3067\u7e70\u308a\u8fd4\u3059 (ReduceImageColors)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<pre class=\"superpre c\">\nstatic void ReduceImageColors(const Image *image,CubeInfo *cube_info)\n{\n#define ReduceImageTag  \"Reduce\/Image\"\n\n  MagickBooleanType\n    proceed;\n\n  MagickOffsetType\n    offset;\n\n  unsigned long\n    span;\n\n  cube_info->next_threshold=0.0;\n  for (span=cube_info->colors; cube_info->colors > cube_info->maximum_colors; )\n  {\n    cube_info->pruning_threshold=cube_info->next_threshold;\n    cube_info->next_threshold=cube_info->root->quantize_error-1;\n    cube_info->colors=0;\n    Reduce(image,cube_info,cube_info->root);\n\uff1c\u7565\uff1e<\/pre>\n<ul>\n<li>  \u30c4\u30ea\u30fc\u3092\u8fbf\u3063\u3066\u3001prune_threshold \u4ee5\u4e0b\u306e\u7acb\u65b9\u4f53\u3092\u3072\u3068\u3064\u4e0a\u306b\u5438\u53ce\u3055\u305b\u308b (Reduce)<\/li>\n<\/ul>\n<pre class=\"superpre c\">\nstatic void Reduce(const Image *image,CubeInfo *cube_info,\n  const NodeInfo *node_info)\n{\n  register long\n    i;\n\n  unsigned long\n    number_children;\n\n  \/*\n    Traverse any children.\n  *\/\n  number_children=cube_info->associate_alpha == MagickFalse ? 8UL : 16UL;\n  for (i=0; i < (long) number_children; i++)\n    if (node_info->child[i] != (NodeInfo *) NULL)\n      Reduce(image,cube_info,node_info->child[i]);\n  if (node_info->quantize_error <= cube_info->pruning_threshold)\n    PruneChild(image,cube_info,node_info);\n  else\n    {\n      \/*\n        Find minimum pruning threshold.\n      *\/\n      if (node_info->number_unique > 0)\n        cube_info->colors++;\n      if (node_info->quantize_error < cube_info->next_threshold)\n        cube_info->next_threshold=node_info->quantize_error;\n    }\n}<\/pre>\n<h4 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_2\"> \u30b9\u30c6\u30c3\u30d7\u3092\u8ffd\u3063\u3066\u89e3\u8aac<\/h4>\n<p>\u307e\u305a\u306f\u3001\u6d88\u3059\u5bfe\u8c61\u3092\u63a2\u3059\u306e\u306bRGB\u8272\u7a7a\u9593\u306e\u30c4\u30ea\u30fc\u3092\u5168\u63a2\u7d22\u3057\u3066\u3001\u4e00\u756a\u5c0f\u3055\u306a quantize_error \u5024\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002(\u56f3\u306e\u4f8b\u306f\u6df1\u3055\uff11\u3067\u3059\u304c\u3001\u5b9f\u969b\u306b\u306f\u518d\u5e30\u3067\u3082\u3063\u3068\u6df1\u3044\u30c4\u30ea\u30fc\u304c\u69cb\u6210\u3055\u308c\u307e\u3059)<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/prune-child-1\/\" rel=\"attachment wp-att-5920\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-1.png\" alt=\"\" title=\"prune-child-1\" width=\"523\" height=\"301\" class=\"aligncenter size-full wp-image-5920\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-1.png 523w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-1-276x158.png 276w\" sizes=\"auto, (max-width: 523px) 100vw, 523px\" \/><\/a><br \/>\n<\/center><\/p>\n<p>\u524d\u56de\u898b\u3064\u3051\u305f quantize_error = 10 \u306e\u7acb\u65b9\u4f53\u3092\u524a\u9664\u3057\u3066\u3001\u540c\u6642\u306b\u3001\u6b8b\u308a\u306e\u7acb\u65b9\u4f53\u306e\u4e2d\u3067\u4e00\u756a quantize_error \u306e\u5c0f\u3055\u306a\u3082\u306e\u3092\u63a2\u3057\u307e\u3059\u3002\u52ff\u8ad6\u3001\u30c4\u30ea\u30fc\u306f\u5168\u63a2\u7d22\u3067\u3059\u3002<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/prune-child-2\/\" rel=\"attachment wp-att-5921\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-2.png\" alt=\"\" title=\"prune-child-2\" width=\"524\" height=\"301\" class=\"aligncenter size-full wp-image-5921\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-2.png 524w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-2-276x158.png 276w\" sizes=\"auto, (max-width: 524px) 100vw, 524px\" \/><\/a><br \/>\n<\/center><\/p>\n<p>\u524d\u56de\u3001quantize_error = 20 \u306e\u7acb\u65b9\u4f53\u3092\u898b\u3064\u3051\u305f\u306e\u3067\u3001\u4eca\u56de\u305d\u308c\u3092\u524a\u9664\u3057\u3066\u3001\u307e\u305f\u6b21\u306b quantize_error \u306e\u5c0f\u3055\u306a\u7acb\u65b9\u4f53\u3092\u63a2\u3057\u307e\u3059\u3002<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/prune-child-3\/\" rel=\"attachment wp-att-5922\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-3.png\" alt=\"\" title=\"prune-child-3\" width=\"522\" height=\"305\" class=\"aligncenter size-full wp-image-5922\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-3.png 522w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-3-276x161.png 276w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/a><br \/>\n<\/center><\/p>\n<p>\u3053\u306e\u3088\u3046\u306b\u3001\uff11\u3064\u306e\u7acb\u65b9\u4f53\u3092\u6d88\u3059\u6bce\u306b\u30c4\u30ea\u30fc\u3092\u5168\u90e8\u8fbf\u308a\u3001\u305d\u306e\u51e6\u7406\u3092\u4f55\u5ea6\u3082\u7e70\u308a\u8fd4\u3059\u306e\u304c\u65e2\u5b58\u306e\u51e6\u7406\u3067\u3059\u3002<\/p>\n<h3 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_3\">\u3000ImageMagick \u306e\u9ad8\u901f\u5316\u89e3\u8aac<\/h3>\n<p>\u8272\u304c\u6b8b\u308b\u30ae\u30ea\u30ae\u30ea\u306e\u95be\u5024\u3092\u5148\u306b\u63a2\u3057\u3066\u304a\u3051\u3070\u3001\u7e70\u308a\u8fd4\u3059\u5fc5\u8981\u304c\u7121\u304f\u306a\u308b\u3068\u8003\u3048\u3001quantize_error \u3092\u5c0f\u3055\u3044\u9806\u306b\u4e26\u3079\u3066\u3001\u95be\u5024\u3092\u63a2\u3059\u51e6\u7406\u3092\u5165\u308c\u307e\u3057\u305f\u3002<\/p>\n<h3 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_4\"> \u6539\u9020\u8a73\u89e3<\/h3>\n<p>\u307e\u305a\u3001RGB\u8272\u7a7a\u9593\u306e\u30c4\u30ea\u30fc\u3092\u5168\u3066\u8fbf\u308a\u3001\u542b\u307e\u308c\u308b\u5168\u3066\u306e quantize_error \u3092\uff11\u3064\u306e\u4e00\u6b21\u5143\u914d\u5217\u306b\u4e26\u3079\u307e\u3059\u3002<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/quantize_error_flatten\/\" rel=\"attachment wp-att-5923\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/quantize_error_flatten.png\" alt=\"\" title=\"quantize_error_flatten\" width=\"519\" height=\"399\" class=\"aligncenter size-full wp-image-5923\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/quantize_error_flatten.png 519w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/quantize_error_flatten-260x200.png 260w\" sizes=\"auto, (max-width: 519px) 100vw, 519px\" \/><\/a><br \/>\n<\/center><\/p>\n<ul>\n<li>  \u5bfe\u5fdc\u30b3\u30fc\u30c9\u3000(magick\/quantize.c)<\/li>\n<\/ul>\n<pre class=\"superpre c\">\nstatic unsigned int QuantizeErrorFlatten(const Image *image, CubeInfo *cube_info,\n                                   const NodeInfo *node_info,\n                                   MagickRealType *quantize_error_list,\n                                   int quantize_error_offset,\n                                   int quantize_error_offset_max) {\n    long  number_children;\n    register long i, num ;\n    if (quantize_error_offset >= quantize_error_offset_max) {\n        fprintf(stderr, \"quantize_error_offset >= quantize_error_offset_max\\n\");\n        return 0;\n    }\n    quantize_error_list[quantize_error_offset] = node_info->quantize_error;\n    num = 1;\n    number_children=cube_info->associate_alpha == MagickFalse ? 8UL : 16UL;\n    for (i = 0; i < number_children ; i++) {\n        if (node_info->child[i] != (NodeInfo *) NULL) {\n            num += QuantizeErrorFlatten(image,cube_info,node_info->child[i],\n                                  quantize_error_list, quantize_error_offset+num,\n                                  quantize_error_offset_max);\n        }\n    }\n    return num;\n}<\/pre>\n<p>qsort \u3067\u5c0f\u3055\u3044\u9806\u306b\u4e26\u3079\u3066\u3001\u6b8b\u3057\u305f\u3044\u8272\u6570\u30ae\u30ea\u30ae\u30ea\u306e quantize_error \u3092\u6577\u5c45\u5024\u3068\u3057\u3066\u63a1\u7528\u3057\u307e\u3059\u3002<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/quantize_error_qsort\/\" rel=\"attachment wp-att-5916\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/quantize_error_qsort.png\" alt=\"\" title=\"quantize_error_qsort\" width=\"524\" height=\"248\" class=\"aligncenter size-full wp-image-5916\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/quantize_error_qsort.png 524w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/quantize_error_qsort-276x130.png 276w\" sizes=\"auto, (max-width: 524px) 100vw, 524px\" \/><\/a><br \/>\n<\/center><\/p>\n<p>\u3053\u3046\u3057\u3066\u898b\u3064\u3051\u305f quantize_error \u3092 cube_info->pruning_threshold \u306e\u521d\u671f\u5024\u3068\u3057\u3066\u4ee3\u5165\u3057\u3066\u304a\u3051\u3070\u3001\u30c4\u30ea\u30fc\u3092\u4e00\u5ea6\u8fbf\u308b\u3060\u3051\u3067\u8272\u7a7a\u9593\u306e\u7d71\u5408\u51e6\u7406\u304c\u7d42\u308f\u308a\u307e\u3059\u3002\u5c1a\u3001\u30b3\u30fc\u30c9\u306e\u4e0a\u3067\u306f next_threshold \u3092\u4ecb\u3057\u3066 while \u306e\u982d\u3067 pruning_threshold \u306b\u4ee3\u5165\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/prune-child-all\/\" rel=\"attachment wp-att-5924\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-all.png\" alt=\"\" title=\"prune-child-all\" width=\"522\" height=\"308\" class=\"aligncenter size-full wp-image-5924\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-all.png 522w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/prune-child-all-276x162.png 276w\" sizes=\"auto, (max-width: 522px) 100vw, 522px\" \/><\/a><br \/>\n<\/center><\/p>\n<ul>\n<li> \u5bfe\u5fdc\u30b3\u30fc\u30c9<\/li>\n<\/ul>\n<pre class=\"superpre c\">\nstatic int MagickRealTypeCmp(const void *a, const void *b) {\n    MagickRealType *af = (MagickRealType *) a;\n    MagickRealType *bf = (MagickRealType *) b;\n    if (*af > *bf) return 1;\n    return -1;\n}\n\nstatic void ReduceImageColors(const Image *image,CubeInfo *cube_info)\n{\n\uff1c\u7565\uff1e\n  cube_info->next_threshold=0.0;\n  \/* yoya speed up customize *\/\n  if (cube_info->colors > cube_info->maximum_colors) {\n      MagickRealType *quantize_error_list;\n      unsigned int quantize_error_result;\n      quantize_error_list = malloc(sizeof(MagickRealType) * cube_info->nodes);\n      quantize_error_result = QuantizeErrorFlatten(image, cube_info,cube_info->root,\n                                                   quantize_error_list,\n                                                   0, cube_info->nodes);\n      qsort(quantize_error_list, cube_info->nodes, sizeof(MagickRealType), MagickRealTypeCmp);\n      cube_info->next_threshold = quantize_error_list[cube_info->nodes - cube_info->maximum_colors];\n      free(quantize_error_list);\n  }<\/pre>\n<h3 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_5\"> \u6539\u9020\u7d50\u679c\u306e\u691c\u8a3c<\/h3>\n<ul>\n<li> ImageMagick \u306e convert \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u3063\u3066\u30a2\u30d0\u30bf\u30fc\u753b\u50cf\u3092 PNG \u304b\u3089 GIF \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u5909\u63db\u3057\u3066\u3001\u6539\u9020\u524d\u5f8c\u3067\u6642\u9593\u3092\u6bd4\u8f03\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<h4 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_6\"> \u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u8a08\u6e2c<\/h4>\n<p>\u51e6\u7406\u306e\u91cd\u305f\u305d\u3046\u306a\u30a2\u30d0\u30bf\u30fc\u753b\u50cf\u3067\u5b9f\u9a13\u3057\u307e\u3059\u3002<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/avatar\/\" rel=\"attachment wp-att-5743\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/09\/avatar.gif\" alt=\"\" title=\"avatar\" width=\"230\" height=\"190\" class=\"aligncenter size-full wp-image-5743\" \/><\/a><br \/>\n<\/center><\/p>\n<ul>\n<li> \u30aa\u30ea\u30b8\u30ca\u30eb ImageMagick (v6.6.0)<\/li>\n<\/ul>\n<pre class=\"superpre \">\n% time \/home\/yoya\/test\/im660\/bin\/convert -layers optimize avatar[1-8].png avatar.gif\n\nreal    0m5.436s\nuser    0m5.416s\nsys 0m0.052s<\/pre>\n<ul>\n<li> \u6539\u9020\u7248 ImageMagick<\/li>\n<\/ul>\n<pre class=\"superpre \">\n% time \/home\/yoya\/test\/im660y\/bin\/convert -layers optimize avatar[1-8].png avatar.gif\n\nreal    0m0.581s\nuser    0m0.548s\nsys 0m0.052s<\/pre>\n<p>10\u500d\u8fd1\u304f\u901f\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u306f\u6975\u7aef\u306a\u4f8b\u3067\u3059\u304c\u3001\u8272\u6570\u306e\u591a\u3044\u30a2\u30d0\u30bf\u30fc\u753b\u50cf\u3067\u3042\u308c\u3070\u3001\u5927\u62b5\u306f\u6570\u500d\u901f\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<h4 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_7\"> \u8a08\u6e2c\u30b0\u30e9\u30d5<\/h4>\n<p>\u672c\u756a\u30b5\u30fc\u30d3\u30b9\u4e0a\u3067\u5b9f\u969b\u306b\u8868\u793a\u3055\u308c\u3066\u3044\u305f\u30a2\u30d0\u30bf\u30fc\u753b\u50cf\u304b\u30891000\u7a2e\u985e\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3057\u3066\u3001\u51e6\u7406\u6642\u9593\u304c\u3069\u3046\u5909\u308f\u308b\u306e\u304b\u30b0\u30e9\u30d5\u5316\u3057\u307e\u3057\u305f\u3002<br \/>\n\u5404\u3005\u306e\u30a2\u30d0\u30bf\u30fc\u7d20\u6750\u306e\u9759\u6b62\u753b\u50cf\u3092 convert \u30b3\u30de\u30f3\u30c9\u3067 GIF \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306b\u5909\u63db\u3057\u3066\u3001\u51e6\u7406\u6642\u9593\u306e\u30c8\u30ea\u30e0\u5e73\u5747(<a href=\"#hs_12799ebbc244260b8f5867ebe29a1e8e_footnote_1\" id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_footnotelink_1\" title=\"\u7570\u5e38\u5024\u3092\u5916\u3057\u305f\u4e0a\u3067\u5e73\u5747\u5024\u3092\u53d6\u308b\u624b\u6cd5\">*1<\/a>)\u3092\u77ed\u3044\u9806\u3067\u4e26\u3079\u307e\u3059\u3002\u7e26\u8ef8\u306e\u5358\u4f4d\u306f\u79d2\u6570\u3067\u3059\u3002<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/graph-im660-im660y\/\" rel=\"attachment wp-att-5792\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/graph-im660-im660y.png\" alt=\"\" title=\"graph-im660-im660y\" width=\"372\" height=\"214\" class=\"aligncenter size-full wp-image-5792\" srcset=\"https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/graph-im660-im660y.png 372w, https:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/graph-im660-im660y-276x158.png 276w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/a><br \/>\n<\/center><\/p>\n<p>\u51e6\u7406\u306b\u6642\u9593\u304c\u304b\u304b\u308b\u7a0b\u3001\u6539\u5584\u52b9\u679c\u304c\u5f37\u304f\u3042\u3089\u308f\u308c\u308b\u3001\u5927\u5909\u90fd\u5408\u306e\u826f\u3044\u7d50\u679c\u304c\u51fa\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u306a\u3089\u3001\u4eca\u307e\u3067\u30a2\u30d0\u30bf\u30fc\u306e\u753b\u50cf\u751f\u6210\u3067\u30e6\u30fc\u30b6\u304c30\u79d2\u5f85\u305f\u3055\u308c\u308b\u3088\u3046\u306a\u72b6\u6cc1\u3067\u30822,3\u79d2\u3067\u6e08\u3080\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<h3 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_8\"> \u554f\u984c\u70b9<\/h3>\n<p>\u3046\u307e\u3044\u8a71\u3070\u304b\u308a\u3067\u306a\u304f\u3001\u8d64\u9752\u7dd1\u304c\u307e\u3093\u3079\u3093\u306a\u304f\u4f7f\u308f\u308c\u3001\u304b\u3064\u5404\u3005\u306b\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u304c\u591a\u7528\u3055\u308c\u308b\u753b\u50cf\u3067\u30ab\u30e9\u30fc\u30d0\u30f3\u30c7\u30a3\u30f3\u30b0(<a href=\"#hs_12799ebbc244260b8f5867ebe29a1e8e_footnote_2\" id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_footnotelink_2\" title=\"\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u8ae7\u8abf\u304c\u6bb5\u968e\u7684\u306b\u306a\u308b\u73fe\u8c61\">*2<\/a>)\u304c\u767a\u751f\u3057\u6613\u304f\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30e6\u30fc\u30b6\u306e\u30a2\u30d0\u30bf\u30fc\u753b\u50cf\u3092300\u679a\u7a0b\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3088\u3046\u3084\u304f\u898b\u3064\u3051\u305f\u4f8b\u3092\u6319\u3052\u307e\u3059\u3002<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/winter1\/\" rel=\"attachment wp-att-5868\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/winter1.gif\" alt=\"\" title=\"winter1\" width=\"230\" height=\"190\" class=\"aligncenter size-full wp-image-5868\" \/><\/a> => <a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/winter2\/\" rel=\"attachment wp-att-5869\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/winter2.gif\" alt=\"\" title=\"winter2\" width=\"230\" height=\"190\" class=\"aligncenter size-full wp-image-5869\" \/><\/a><br \/>\n<\/center><br \/>\n\u3071\u3063\u3068\u898b\u3067\u306f\u5206\u304b\u308a\u306b\u304f\u3044\u306e\u3067\u3001\u62e1\u5927\u3057\u3066\u30d4\u30af\u30bb\u30eb\u5358\u4f4d\u3067\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<br \/>\n<center><br \/>\n<a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/winter1-expand\/\" rel=\"attachment wp-att-5870\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/winter1-expand.png\" alt=\"\" title=\"winter1-expand\" width=\"168\" height=\"192\" class=\"aligncenter size-full wp-image-5870\" \/><\/a><a href=\"http:\/\/labs.gree.jp\/blog\/2012\/10\/5249\/winter2-expand\/\" rel=\"attachment wp-att-5871\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/labs.gree.jp\/blog\/wp-content\/uploads\/2012\/10\/winter2-expand.png\" alt=\"\" title=\"winter2-expand\" width=\"168\" height=\"192\" class=\"aligncenter size-full wp-image-5871\" \/><\/a><br \/>\n<\/center><br \/>\n\u5de6\u982c\u306e\u9818\u57df\u306b\u7740\u76ee\u3059\u308b\u3068\u3001\u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u8ae7\u8abf\u304c\u4e00\u3064\u6e1b\u3063\u3066\u3044\u308b\u306e\u304c\u5206\u304b\u308a\u307e\u3059\u3002\u3053\u306e\u539f\u56e0\u306f\u307e\u3060\u4e0d\u660e\u3067\u3059\u3002<\/p>\n<p>\u5b9f\u306f\u3001QuantizeErrorFratten \u306e\u51e6\u7406\u306b\u304a\u3044\u3066\u3001\uff11\u3064\u306e\u7acb\u65b9\u4f53\u306e\u4e2d\u306b\u8907\u6570\u306e\u8272\u30d1\u30ec\u30c3\u30c8\u304c\u3042\u308b\u5834\u5408\u3092\u8003\u616e\u3057\u3066\u3044\u306a\u3044\u554f\u984c\u304c\u3042\u308a\u307e\u3059\u304c\u3001\u8272\u7a7a\u9593\u306e\u5206\u5272\u3092\u30b1\u30c1\u308b\u306e\u306f22\u4e07\u30ce\u30fc\u30c9\u306b\u9054\u3057\u305f\u6642\u3067\u3001\u4e0a\u8a18\u306e\u5143\u753b\u50cf\u306f\uff11\u4e07\u8272\u306a\u306e\u3067\u3001\u3053\u306e\u554f\u984c\u306b\u306f\u3042\u305f\u308a\u307e\u305b\u3093\u3002<br \/>\n\u4eee\u306b22\u4e07\u8272\u4ee5\u4e0a\u3042\u3063\u305f\u3068\u3057\u3066\u3082\u3001\u6307\u5b9a\u3057\u305f\u8272\u6570\u306e\u7acb\u65b9\u4f53\u304c\u6b8b\u308b\u3088\u3046\u306b\u30aa\u30d5\u30bb\u30c3\u30c8\u3092\u6307\u5b9a\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u5927\u76ee\u306b\u8272\u304c\u6b8b\u308a\u7701\u7565\u3059\u308b\u3064\u3082\u308a\u306e\u30eb\u30fc\u30d7\u304c\u5c11\u3057\u52d5\u3044\u3066\u3057\u307e\u3046\u3060\u3051\u3067\u753b\u8cea\u306b\u5f71\u97ff\u306f\u51fa\u306a\u3044\u306f\u305a\u3067\u3059\u3002<\/p>\n<p>\u6700\u7d42\u7684\u306a\u898b\u305f\u76ee\u306b\u306f\u307b\u307c\u5f71\u97ff\u306a\u3044\u4e0a\u306b\u8868\u793a\u306b\u304b\u304b\u308b\u6642\u9593\u304c\u5727\u5012\u7684\u306b\u77ed\u304f\u306a\u308b\u70ba\u3001\u3053\u308c\u3092\u30b5\u30fc\u30d3\u30b9\u306b\u9069\u7528\u3057\u306a\u3044\u624b\u306f\u306a\u3044\u3067\u3059\u304c\u3001\u753b\u8cea\u3082\u7dad\u6301\u3067\u304d\u308c\u3070\u305d\u308c\u304c\u7406\u60f3\u306a\u306e\u3067\u4eca\u5f8c\u306e\u7814\u7a76\u8ab2\u984c\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h3 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_9\"> \u4ed6\u306e\u6539\u5584\u6848<\/h3>\n<ul>\n<li> RGB\u8272\u7a7a\u9593\u306f\u4eba\u9593\u306e\u8996\u899a\u7279\u6027\u3068\u306f\u8ef8\u3082\u8ddd\u96e2\u3082\u5408\u3044\u307e\u305b\u3093\u3002\u5225\u306e\u8272\u7a7a\u9593\u3067\u51e6\u7406\u3057\u305f\u65b9\u304c\u3088\u308a\u753b\u8cea\u3092\u4fdd\u3066\u305d\u3046\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001CIE XYZ \u3084\u305d\u306e\u6d3e\u751f\u7cfb\u306e Lab \u7b49\u304c\u5019\u88dc\u3068\u3057\u3066\u6319\u3052\u3089\u308c\u307e\u3059\u3002<\/li>\n<li> \u8272\u7a7a\u9593\u5185\u306e\u8ddd\u96e2\u3092\u8a08\u7b97\u3059\u308b\u969b\u306b sqrt \u3067\u5e73\u65b9\u6839\u3092\u3068\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u8ddd\u96e2\u306b\u3064\u3044\u3066\u306f\u52a0\u7b97\u3068\u6bd4\u8f03\u3057\u304b\u306a\u3044\u306e\u3067\u3001\u8ddd\u96e2\u306e\u81ea\u4e57\u306e\u307e\u307e\u51e6\u7406\u3057\u305f\u65b9\u304c CPU \u306e\u8ca0\u8377\u304c\u4f4e\u3044\u3068\u601d\u308f\u308c\u307e\u3059\u3002<\/li>\n<li> ImageMagick \u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067 build \u3059\u308b\u3068 RGB \u3092\u5404\u3005 16bits \u3067\u5185\u90e8\u51e6\u7406\u3057\u307e\u3059\u3002Web \u306e\u4e16\u754c\u3067\u306f\u307b\u307c 8bits \u3067\u3059\u306e\u3067\u3001configure \u6642\u306b --with-quantum-depth=8 (\u306f\u3058\u3081\u306e - \u306f\u4e8c\u3064)\u3092\u6307\u5b9a\u3059\u308b\u3068\u753b\u8cea\u3092\u6b86\u3069\u7dad\u6301\u3057\u305f\u307e\u307e\u3001\u6027\u80fd\u3092\u5c11\u306a\u304b\u3089\u305a up \u3067\u304d\u307e\u3059\u3002\u305f\u3060\u3001\u6e1b\u8272\u51e6\u7406\u306b\u95a2\u3057\u3066\u306f\u6b86\u3069\u5909\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<\/li>\n<\/ul>\n<h3 id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_header_10\"> \u6700\u5f8c\u306b\u307e\u3068\u3081<\/h3>\n<p>\u4eca\u56de\u306e\u6539\u9020\u3092\u77ed\u304f\u8aac\u660e\u3059\u308b\u3068<\/p>\n<ul>\n<li> \u6e1b\u8272\u51e6\u7406\u306b\u4f7f\u3046 RGB(A) \u8272\u7a7a\u9593\u3092\u8868\u3059 8\u9032\u6728(or16\u9032\u6728)\u306e\u5404\u30ce\u30fc\u30c9\u306b\u3042\u308b quantize_error \u3092\u4e00\u6b21\u5143\u914d\u5217\u306b\u5c55\u958b\u3057\u3066 qsort \u3067\u6607\u9806\u306b\u4e26\u3079\u3001256\u8272\u304c\u6b8b\u308b\u30aa\u30d5\u30bb\u30c3\u30c8\u3067 quantize_error \u306e\u95be\u5024\u3092\u53d6\u5f97\u3057\u3001cube_info->pruning_threshold \u306e\u521d\u671f\u5024\u306b\u3059\u308b\u3002<\/li>\n<\/ul>\n<p>\u3068\u306a\u308a\u307e\u3059\u3002\u6539\u9020\u81ea\u4f53\u306f\u7c21\u5358\u3067\u3059\u3002<\/p>\n<p>\u305d\u306e\u58f1\u3067\u7d39\u4ecb\u3057\u305f GIF \u30a2\u30cb\u30e1(\u643a\u5e2f\u7aef\u672b)\u4e0d\u5177\u5408\u5bfe\u5fdc\u30d1\u30c3\u30c1\u3082\u542b\u3081\u3001\u672c\u4ef6\u306e\u6539\u9020\u30d1\u30c3\u30c1\u3092 Github \u306b commit \u3057\u307e\u3057\u305f\u3002\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n<ul>\n<li>\n <a href=\"https:\/\/github.com\/gree\/YoyaMagick\"> https:\/\/github.com\/gree\/YoyaMagick <\/a><\/p>\n<ul>\n<li>  <a href=\"https:\/\/github.com\/gree\/YoyaMagick\/commit\/a6901b4d1687f5089fa7900cb19520f064a74312\"> GIF \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3 2x2 \u4fdd\u969c\u30d1\u30c3\u30c1 <\/a><\/li>\n<li>  <a href=\"https:\/\/github.com\/gree\/YoyaMagick\/commit\/b2d216c9143626075fccd5f03a7c63782161d63e\"> \u6e1b\u8272\u9ad8\u901f\u5316\u30d1\u30c3\u30c1 <\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u5c11\u3057\u3084\u308a\u904e\u304e\u305f\u70ba\u3001\u793e\u5185\u3067\u306f\u5c5e\u4eba\u7684\u306a\u30d1\u30c3\u30b1\u30fc\u30b8\u540d\u3067\u547c\u3070\u308c\u3066\u3044\u307e\u3059\u3002\u5fa1\u4e86\u627f\u4e0b\u3055\u3044\u3002<\/p>\n<p>Debian squeeze \u306e\u30d1\u30c3\u30b1\u30fc\u30b8\u306b\u5408\u308f\u305b\u3066 ImageMagick \u306e\u5143 version \u306f 6.6.0.4 \u3067\u3059\u304c\u3001\u6700\u65b0\u306e ImageMagick \u306b\u3082\u3001\u307b\u307c\u30b3\u30d4\u30da\u3067\u9069\u7528\u51fa\u6765\u308b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u3067\u3059\u3002<\/p>\n<div class=\"footnote\">\n<p id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_footnote_1\"><a href=\"#hs_12799ebbc244260b8f5867ebe29a1e8e_footnotelink_1\">*1<\/a>: \u7570\u5e38\u5024\u3092\u5916\u3057\u305f\u4e0a\u3067\u5e73\u5747\u5024\u3092\u53d6\u308b\u624b\u6cd5<\/p>\n<p id=\"hs_12799ebbc244260b8f5867ebe29a1e8e_footnote_2\"><a href=\"#hs_12799ebbc244260b8f5867ebe29a1e8e_footnotelink_2\">*2<\/a>: \u30b0\u30e9\u30c7\u30fc\u30b7\u30e7\u30f3\u306e\u8ae7\u8abf\u304c\u6bb5\u968e\u7684\u306b\u306a\u308b\u73fe\u8c61<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306f\u3002\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u57fa\u76e4\u30c1\u30fc\u30e0\u306e\u3088\u3084\u3067\u3059\u3002 \u6e1b\u8272\u51e6\u7406\u306e\u8a71\u306e\u7d9a\u304d\u3067\u3001ImageMagick \u306e\u6539\u9020\u306b\u3064\u3044\u3066\u304a\u8a71\u3057\u307e\u3059\u3002 \u524d\u56de > ImageMagick \u6539\u9020\u5165\u9580 (\u305d\u306e\u5f10) \u6e1b\u8272\u51e6\u7406\u524d\u7de8 ImageMagick \u6e1b\u8272 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[23],"class_list":["post-5249","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-info","tag-image"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/5249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/comments?post=5249"}],"version-history":[{"count":3,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/5249\/revisions"}],"predecessor-version":[{"id":21164,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/posts\/5249\/revisions\/21164"}],"wp:attachment":[{"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/media?parent=5249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/categories?post=5249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/labs.gree.jp\/blog\/wp-json\/wp\/v2\/tags?post=5249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}