weixin_39626131
2021-01-11 21:28 阅读 26

compare: width or height exceeds limit `img.png' @ error/cache.c/OpenPixelCache/3690.\n"

I'm trying to compare two images.

Version: ImageMagick 7.0.10-31 Q16 x86_64 2020-09-22 https://imagemagick.org Copyright: © 1999-2020 ImageMagick Studio LLC License: https://imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(4.5) Delegates (built-in): jbig jng jpeg ltdl lzma png tiff x zlib


magick compare base.png new.png -metric RMSE -subimage-search -dissimilarity-threshold 1.0 diff.png

but i get


b"compare: width or height exceeds limit `base.png' @ error/cache.c/OpenPixelCache/3690.\n"
  1. I changed the file "policy.xml"
  2. I was using '-limit'

  3. Resource limits: Width: 16000000P Height: 16000000P Area: 33.1224GP List length: unlimited Memory: 14GiB Map: 30GiB Disk: 30GiB File: 786432 Thread: 12 Throttle: 0 Time: unlimited 2. Size of base.png and new.png: ~3mb

该提问来源于开源项目:ImageMagick/ImageMagick

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

5条回答 默认 最新

  • weixin_39933082 weixin_39933082 2021-01-11 21:28

    try this syntax

    magick compare -metric rmse -subimage-search -disimilarity-threshold 1 large_image small_image diff_image

    Note the large image comes before the small image. Also I put all settings before the images.

    Does your small image have a width larger than that of the large image? The small image must be smaller in both dimension than that of the large image.

    点赞 评论 复制链接分享
  • weixin_39626131 weixin_39626131 2021-01-11 21:28

    Thank you, I'll try it tomorrow at my workstation and write results here.

    点赞 评论 复制链接分享
  • weixin_39626131 weixin_39626131 2021-01-11 21:28

    now its working in 3/10 cases

    Note the large image comes before the small image.

    Is this a prerequisite ? If yes, Then I have to determine the file size and place arguments in command line dynamically.

    The small image must be smaller in both dimension than that of the large image.

    I'm trying to compare 2 screenshots of a page. How do I make them the same size ?

    And now sometimes when comparing I get two images instead of one: diff-0.jpg, diff-1.jpg. diff-1.jpg - just a white line.

    点赞 评论 复制链接分享
  • weixin_39933082 weixin_39933082 2021-01-11 21:28

    Yes, it is required that the large image is first. When using subimage-search, you may get two images - the first is the diff and the second is the correlation surface image showing where the best match is located.

    If you compare two same sized images, then you do not need -subimage-search and will only get the diff image.

    If the two images are not the same size, then how do you know where the excess size is located -- on which side(s)? If they do not align then you will get differences. You could also crop to the same size, but you have to know which side(s) to remove so that they properly align. You need to resolve that issue before either padding or cropping.

    点赞 评论 复制链接分享
  • weixin_39626131 weixin_39626131 2021-01-11 21:28

    thx, its kinda work now)

    点赞 评论 复制链接分享

相关推荐