ImageMagick-7.0.8-31差分

ImageMagick-7.0.8-31差分

http://www.imagemagick.org/script/download.php
The latest release of ImageMagick is version 7.0.8-31

6 系同時リリースは ImageMagick-6.9.10-31

まとめ

  • -trim が画像の virtual canvas に過敏に反応しないようにした。
気になる事

差分

  • -trim が画像の virtual canvas に過敏に反応しないようにした。
    • MagickCore/attribute.c
      • 入力 image と別に作業用の edge_image を別に作って、そこで処理。
244c244
<     *image_view;
---
>     *edge_view;
256a257,259
>   Image
>     *edge_image;
>
267a271,274
>   edge_image=CloneImage(image,0,0,MagickTrue,exception);
>   if (edge_image == (Image *) NULL)
>     return(bounds);
>   (void) ParseAbsoluteGeometry("0x0+0+0",&edge_image->page);
269,277c276,284
<   image_view=AcquireVirtualCacheView(image,exception);
<   edge.left=GetEdgeBackgroundFactor(image,image_view,WestGravity,1,0,0,0,
<     exception);
<   edge.right=GetEdgeBackgroundFactor(image,image_view,EastGravity,1,0,0,0,
<     exception);
<   edge.top=GetEdgeBackgroundFactor(image,image_view,NorthGravity,0,1,0,0,
<     exception);
<   edge.bottom=GetEdgeBackgroundFactor(image,image_view,SouthGravity,0,1,0,0,
<     exception);
---
>   edge_view=AcquireVirtualCacheView(edge_image,exception);
>   edge.left=GetEdgeBackgroundFactor(edge_image,edge_view,WestGravity,
>     1,0,0,0,exception);
>   edge.right=GetEdgeBackgroundFactor(edge_image,edge_view,EastGravity,
>     1,0,0,0,exception);
>   edge.top=GetEdgeBackgroundFactor(edge_image,edge_view,NorthGravity,
>     0,1,0,0,exception);
>   edge.bottom=GetEdgeBackgroundFactor(edge_image,edge_view,SouthGravity,
>     0,1,0,0,exception);
279c286
<   artifact=GetImageArtifact(image,"trim:percent-background");
---
>   artifact=GetImageArtifact(edge_image,"trim:percent-background");
297,303c304,312
    (同様に image の代わりに edge_image で処理)
357c370,371
<   image_view=DestroyCacheView(image_view);
---
>   edge_view=DestroyCacheView(edge_view);
>   edge_image=DestroyImage(edge_image);
361d374
<     {
364,365d376
<       SetGeometry(image,&bounds);
<     }

ChangeLog にない差分

  • MagickCore/cache.c
    • 今までは黙って NULL 返すだけのとこにエラー表示を追加。
    • MagickResouce のリークしそうだけど大丈夫?
static inline MagickBooleanType AcquireCacheNexusPixels(
  const CacheInfo *magick_restrict cache_info,const MagickSizeType length,
  NexusInfo *nexus_info,ExceptionInfo *exception)
{
  if (length != (MagickSizeType) ((size_t) length))
    {
>      (void) ThrowMagickException(exception,GetMagickModule(),
>        ResourceLimitError,"PixelCacheAllocationFailed","`%s'",
>        cache_info->filename);
      return(MagickFalse);
    }
4990c4995
<         ResourceLimitError,"MemoryAllocationFailed","`%s'",
---
>         ResourceLimitError,"PixelCacheAllocationFailed","`%s'",
static Quantum *SetPixelCacheNexusPixels(const CacheInfo *cache_info,
  const MapMode mode,const RectangleInfo *region,
  const MagickBooleanType buffered,NexusInfo *nexus_info,
  ExceptionInfo *exception)
5029a5035,5037
>     {
>       (void) ThrowMagickException(exception,GetMagickModule(),CacheError,
>         "NoPixelsDefinedInCache","`%s'",cache_info->filename);
5030a5039,5040
>     }
>   assert(nexus_info->signature == MagickCoreSignature);
  /*
    Pixels are stored in a staging region until they are synced to the cache.
  */
5066a5077,5085
>   if (((region->x != (ssize_t) nexus_info->region.width) ||
>        (region->y != (ssize_t) nexus_info->region.height)) &&
>       ((AcquireMagickResource(WidthResource,region->width) == MagickFalse) ||
>        (AcquireMagickResource(HeightResource,region->height) == MagickFalse)))
>     {
>       (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
>         "WidthOrHeightExceedsLimit","`%s'",cache_info->filename);
>       return((Quantum *) NULL);
>     }

ChangeLog

2019-03-04  7.0.8-31 Cristy  <quetzlzacatenango@image...>
  * -trim is no longer sensitive to the image virtual canvas.