ImageMagick-7.0.10-29差分

ImageMagick-7.0.10-29差分

The latest release of ImageMagick is version 7.0.10-29

6 系同時リリースは ImageMagick-6.9.11-29

まとめ

  • AVIF/HEIF の Windows エンコード対応。(いままで Windows だけ無効化してた)
    • ChangeLog にないが、AVIF 対応自体は 7.0.10-24 から動作していて、libheif 1.7.0 以降で aom を使う設定になっていれば AVIF の変換ができる。ソースコードを読むと rav1e/rav1d でも動作しそうだが、こっちは動作未確認。
  • TIFF のクリップパスが -extent でずれる件の修正。
  • SVG で無限ループする不具合対処
  • JSON ファイルフォーマットにバージョン要素を追加
気になる事
  • AVIF 対応が #if で libheif 1.6.2 より後としてるので、仮に 1.7 や 1.8 からバックポートされた 1.6.3 が出るとビルド出来なくなる。杞憂な気もするが。
  • SVG で currentColor 対応してる。

差分

-- 96d95
< #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
102d100
< #endif
612d609
< #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
615d611
< #endif
627d622
< #if !defined(MAGICKCORE_WINDOWS_SUPPORT)
630d624
< #endif
694c688
< #if defined(MAGICKCORE_HEIC_DELEGATE) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
---
> #if defined(MAGICKCORE_HEIC_DELEGATE)
857a852,865
>       Get encoder for the specified format.
>     */
> #if LIBHEIF_NUMERIC_VERSION > 0x01060200
>     if (LocaleCompare(image_info->magick,"AVIF") == 0)
>       error=heif_context_get_encoder_for_format(heif_context,
>         heif_compression_AV1,&heif_encoder);
>     else
> #endif
>       error=heif_context_get_encoder_for_format(heif_context,
>         heif_compression_HEVC,&heif_encoder);
>     status=IsHeifSuccess(&error,image,exception);
>     if (status == MagickFalse)
>       break;
>     /*
942,951d949
<     error=heif_context_get_encoder_for_format(heif_context,
<       heif_compression_HEVC,&heif_encoder);
< #if LIBHEIF_NUMERIC_VERSION > 0x01060200
<     if (LocaleCompare(image_info->magick,"AVIF") == 0)
<       error=heif_context_get_encoder_for_format(heif_context,
<         heif_compression_AV1,&heif_encoder);
< #endif
<     status=IsHeifSuccess(&error,image,exception);
<     if (status == MagickFalse)
<       break;
2387a2388,2535
>
> static void UpdateClipPath(unsigned char *blob,size_t length,
>   const size_t old_columns,const size_t old_rows,
>   const RectangleInfo *new_geometry)
> {
(略)
> MagickPrivate void Update8BIMClipPath(const StringInfo *profile,
>   const size_t old_columns,const size_t old_rows,
>   const RectangleInfo *new_geometry)
(略)
      • MagickCore/transform.c (ワークアラウンド を元に戻して、今回追加した Update8BIMClipPath を新たに呼ぶ)
62a63
> #include "MagickCore/profile-private.h"
1135a1137,1139
>   const StringInfo
>     *profile;
>
1150d1153
<   (void) DeleteImageProfile(extent_image,"8bim");  /* delete clipping path */
1158a1162,1167
>   if (status != MagickFalse)
>     {
>       profile=GetImageProfile(extent_image,"8bim");
>       if (profile != (StringInfo *) NULL)
>         Update8BIMClipPath(profile,image->columns,image->rows,geometry);
>     }
949c949,950
<     user_time;
---
>     user_time,
>     version;
984c985,992
<   JSONFormatLocaleFile(file,"{\n  \"image\": {\n    \"name\": %s,\n",
---
>   (void) FormatLocaleFile(file,"\n{\n");
>   version=1.0;
>   artifact=GetImageArtifact(image,"json:version");
>   if (artifact != (const char *) NULL)
>     version=StringToDouble(artifact,(char **) NULL);
>   if (version >= 1.0)
>     (void) FormatLocaleFile(file,"  \"version\": \"%.1f\",\n",version);
>   JSONFormatLocaleFile(file,"  \"image\": {\n    \"name\": %s,\n",
1036,1037c1044,1049
<   JSONFormatLocaleFile(file,"    \"endianness\": %s,\n",
<     CommandOptionToMnemonic(MagickEndianOptions,(ssize_t) image->endian));
---
>   if (version < 1.0)
>     JSONFormatLocaleFile(file,"    \"endianess\": %s,\n",
>       CommandOptionToMnemonic(MagickEndianOptions,(ssize_t) image->endian));
>   else
>     JSONFormatLocaleFile(file,"    \"endianness\": %s,\n",
>       CommandOptionToMnemonic(MagickEndianOptions,(ssize_t) image->endian));

ソースコード

  • MagickCore/accelerate-kernels-private.h
    • RoundToUnity 関数を廃止
352,358d351
<   static inline float RoundToUnity(const float value)
<    {
<      return clamp(value,0.0f,1.0f);
<    }
<   )
  • MagickCore/annotate.c
    • annotate に UTF 文字列を渡した時の処理をリファイン。
632a633,634
>         for (i=0; i < (ssize_t) GetUTFOctets(s); i++)
>           *(s+i)=' ';
637c639
<       if (split != MagickFalse)
---
>       if ((split != MagickFalse) || (GetUTFOctets(p) > 2))
  • MagickCore/cipher.c
    • InverseAddRoundKey で cast を減らしたいので、ByteMultiply の戻り値を byte から unsigned int に変更
293c293
< static inline unsigned char ByteMultiply(const unsigned char alpha,
---
> static inline unsigned int ByteMultiply(const unsigned char alpha,
301c301
<   return(InverseLog[(Log[alpha]+Log[beta]) % 0xff]);
---
>   return((unsigned int) InverseLog[(Log[alpha]+Log[beta]) % 0xff]);
313,314c313,316
<   key=(s_box[x & 0xff]) | (s_box[(x >> 8) & 0xff] << 8) |
<     (s_box[(x >> 16) & 0xff] << 16) | (s_box[(x >> 24) & 0xff] << 24);
---
>   key=((unsigned int) s_box[x & 0xff]) |
>     ((unsigned int) s_box[(x >> 8) & 0xff] << 8) |
>     ((unsigned int) s_box[(x >> 16) & 0xff] << 16) |
>     ((unsigned int) s_box[(x >> 24) & 0xff] << 24);
365c367
<       value|=(*p++ << (8*j));
---
>       value|=((unsigned int) *p++ << (8*j));
  • /MagickCore/composite.c
    • コードの整理
780c780
<       MagickRealType
---
>       double
796,799c796,798
<         Blur Image by resampling.
<
<         Blur Image dictated by an overlay gradient map: X = red_channel;
<           Y = green_channel; compose:args =  x_scale[,y_scale[,angle]].
---
>         Blur Image by resampling dictated by an overlay gradient map:
>           X = red_channel; Y = green_channel; compose:args =
>           x_scale[,y_scale[,angle]].
801,802c800
<       canvas_image=CloneImage(image,0,0,MagickTrue,
<         exception);
---
>       canvas_image=CloneImage(image,0,0,MagickTrue,exception);
825,826c823,824
(略)
  • MagickCore/constitute.c
    • 画像の endian が分からない時、実行環境の endian を設定する際に RawSupport の時をチェックする。
1109c1109,1110
<   if (magick_info != (const MagickInfo *) NULL)
---
>   if ((magick_info != (const MagickInfo *) NULL) &&
>       (GetMagickRawSupport(magick_info) != MagickFalse))
1114,1115c1115
<         if ((image_info->endian == UndefinedEndian) &&
<             (GetMagickRawSupport(magick_info) != MagickFalse))
---
>         if (image_info->endian == UndefinedEndian)


- MagickCore/draw.c
--currentColor 対応(coders/svg.c に対応する出力がある)。 メモリリーク修正
>|c|
2829a2830,2834
>         if (LocaleCompare("currentColor",keyword) == 0)
>           {
>             (void) GetNextToken(q,&q,extent,token);
>             break;
>           }
5481a5487,5490
>             if (clone_info->size != (char *) NULL)
>               clone_info->size=DestroyString(clone_info->size);
>             if (clone_info->extract != (char *) NULL)
>               clone_info->extract=DestroyString(clone_info->extract);
  • /MagickCore/enhance.c
    • InterpolateCLAHE 内の処理で cast 追加。(多分、ワーニング対策)
429,431c429,432
<       *pixels++=(unsigned short ) (PerceptibleReciprocal((double) tile->width*
<         tile->height)*(y*(x*Q12[intensity]+(tile->width-x)*Q22[intensity])+
<         (tile->height-y)*(x*Q11[intensity]+(tile->width-x)*Q21[intensity])));
---
>       *pixels++=(unsigned short) (PerceptibleReciprocal((double) tile->width*
>         tile->height)*(y*((double) x*Q12[intensity]+(tile->width-x)*
>         Q22[intensity])+(tile->height-y)*((double) x*Q11[intensity]+
>         (tile->width-x)*Q21[intensity])));
  • MagickCore/property.c
    • 今となっては余計なケアを削除。
1965,1976c1965,1966
<           size_t
<             xx,
<             yy;
<
<           yy=(size_t) ReadPropertyMSBLong(&blob,&length);
<           xx=(size_t) ReadPropertyMSBLong(&blob,&length);
<           x=(ssize_t) xx;
<           if (xx > 2147483647)
<             x=(ssize_t) xx-4294967295U-1;
<           y=(ssize_t) yy;
<           if (yy > 2147483647)
<             y=(ssize_t) yy-4294967295U-1;
---
>           y=(ssize_t) ReadPropertyMSBLong(&blob,&length);
>           x=(ssize_t) ReadPropertyMSBLong(&blob,&length);
2173,2184c2163,2164
<           unsigned int
<             xx,
<             yy;
<
<           yy=(unsigned int) ReadPropertyMSBLong(&blob,&length);
<           xx=(unsigned int) ReadPropertyMSBLong(&blob,&length);
<           x=(ssize_t) xx;
<           if (xx > 2147483647)
<             x=(ssize_t) xx-4294967295U-1;
<           y=(ssize_t) yy;
<           if (yy > 2147483647)
<             y=(ssize_t) yy-4294967295U-1;
---
>           y=(ssize_t) ReadPropertyMSBLong(&blob,&length);
>           x=(ssize_t) ReadPropertyMSBLong(&blob,&length);
  • MagickCore/quantize.c
    • 減色用色空間内ツリー操作中の色数計算の修正。(これ10年前に自分がミスった分の修正かも。。あわあわ。。
2943,2956c2943,2953
<   if (cube_info->nodes > cube_info->maximum_colors)
<     {
<       /*
<         Merge color statistics into parent.
<       */
<       parent=node_info->parent;
<       parent->number_unique+=node_info->number_unique;
<       parent->total_color.red+=node_info->total_color.red;
<       parent->total_color.green+=node_info->total_color.green;
<       parent->total_color.blue+=node_info->total_color.blue;
<       parent->total_color.alpha+=node_info->total_color.alpha;
<       parent->child[node_info->id]=(NodeInfo *) NULL;
<       cube_info->nodes--;
<     }
---
>   /*
>     Merge color statistics into parent.
>   */
>   parent=node_info->parent;
>   parent->number_unique+=node_info->number_unique;
>   parent->total_color.red+=node_info->total_color.red;
>   parent->total_color.green+=node_info->total_color.green;
>   parent->total_color.blue+=node_info->total_color.blue;
>   parent->total_color.alpha+=node_info->total_color.alpha;
>   parent->child[node_info->id]=(NodeInfo *) NULL;
>   cube_info->nodes--;
  • PerlMagick/demo/demo.pl
    • Perl のでもに CLAHE を追加
99a100,105
> print "CLAHE...\n";
> $example=$model->Clone();
> $example->Label('CLAHE');
> $example->CLAHE('128x192+32+3');
> push(@$images,$example);
  • coders/label.c
    • ReadLABELImage で背景色を設定するときは先に Extent でレイヤーを整理する。
126c126,131
<     (void) SetImageBackgroundColor(image,exception);
---
>     {
>       status=SetImageExtent(image,image->columns,image->rows,exception);
>       if (status == MagickFalse)
>         return(DestroyImageList(image));
>       (void) SetImageBackgroundColor(image,exception);
>     }
  • /coders/ora.c
    • コードの整理?
104,106c104,106
< #if defined(MAGICKCORE_PNG_DELEGATE)
< #if defined(MAGICKCORE_LIBZIP_DELEGATE)
< static Image *ReadORAImage(const ImageInfo *image_info,ExceptionInfo *exception)
---
> #if defined(MAGICKCORE_PNG_DELEGATE) && defined(MAGICKCORE_LIBZIP_DELEGATE)
> static Image *ReadORAImage(const ImageInfo *image_info,
>   ExceptionInfo *exception)
(略)
191,193c194,221
<     read_bytes = zip_fread(merged_image_file, image_data_buffer + offset, MaxBufferExtent - offset);
<     if (read_bytes == -1) {
<       ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
---
>     read_bytes=zip_fread(merged_image_file,image_data_buffer+offset,
>       MaxBufferExtent-offset);
>     if (read_bytes == -1)
>       status=MagickFalse;
>     else if (read_bytes == 0)
>       {
>         /* Write up to offset of image_data_buffer to temp file */
>         if (!fwrite(image_data_buffer,offset,1,file))
>           status=MagickFalse;
>         break;
>       }
  • coders/plasma.c
    • グレースケール以外は sRGB に変換
46a47
> #include "MagickCore/colorspace-private.h"
156a158,159
>   if (IsGrayColorspace(image->colorspace) != MagickFalse)
>     (void) SetImageColorspace(image,sRGBColorspace,exception);
diff -rrB ImageMagick-7.0.10-28/coders/psd.c ImageMagick-7.0.10-29/coders/psd.c
1107,1110c1107
<       {
<         status=MagickFalse;
<         break;
<       }
---
>       break;
  • coders/svg.c
    • currentColor 対応
885a886,887
>             (void) FormatLocaleFile(svg_info->file,"currentColor \"%s\"\n",
>               color);
  • coders/tiff.c
    • この前の do while ループ終了条件が MagickFalse なのでよく分からない。

2242a2243,2244
> if (status != MagickFalse)
> TIFFReadPhotoshopLayers(image_info,image,exception);
2248d2249< TIFFReadPhotoshopLayers(image_info,image,exception);

  • coders/wmf.c
    • cast 修正
842c842
<     GetMagickVersion((unsigned long *) NULL));
---
>     GetMagickVersion((size_t *) NULL));

ChangeLog

2020-09-05  7.0.10-29  <quetzlzacatenango@image...>
  * Release ImageMagick version 7.0.10-29 GIT revision 17580:fc52fa0a9:20200905

2020-09-05  7.0.10-28  <quetzlzacatenango@image...>
  * Eliminate infinite loop for certain SVG styles (reference
    https://github.com/ImageMagick/ImageMagick6/issues/96).
  * Add version element to JSON file format (reference
    https://github.com/ImageMagick/ImageMagick6/issues/91).

2020-09-01  7.0.10-29 Dirk Lemstra <dirk@lem.....org>
  * Enabled support for AVIF encoding on Windows.
  * Clip path in 8bim profile is updated when the image is extended. (reference
    https://github.com/ImageMagick/ImageMagick/issues/2414)