【问题标题】:Limited GraphicsMagick error while displaying image显示图像时出现有限的 GraphicsMagick 错误
【发布时间】:2023-04-07 09:42:01
【问题描述】:

我正在尝试使用以下代码显示图像:

filename = 'testflower.png';
A = importdata(filename);
image(A);

但是,我收到以下错误:

$ octave showimg.m 
warning: your version of GraphicsMagick limits images to 16 bits per pixel
warning: called from
    imformats>default_formats at line 256 column 11
    imformats at line 79 column 3
    imageIO at line 106 column 11
    imread at line 106 column 30
    importdata at line 110 column 50
    showimg.m at line 3 column 3
error: invalid value for array property "cdata"
error: called from
    image>__img__ at line 201 column 5
    image at line 119 column 10
    showimg.m at line 4 column 1

我正在 Debian Stable Linux 上开发 Octave 版本 4.0.3-3。

问题出在哪里,如何解决?感谢您的帮助。

编辑:png 的详细信息(由 cmets 中的@MarkSetchell 建议)如下:

$ pngcheck -v testflower.png 
File: testflower.png (17349 bytes)
  chunk IHDR at offset 0x0000c, length 13
    927 x 258 image, 8-bit palette, non-interlaced
  chunk PLTE at offset 0x00025, length 768: 256 palette entries
  chunk tRNS at offset 0x00331, length 217: 217 transparency entries
  chunk pHYs at offset 0x00416, length 9: 3780x3780 pixels/meter (96 dpi)
  chunk IDAT at offset 0x0042b, length 8192
    zlib: deflated, 32K window, default compression
  chunk IDAT at offset 0x02437, length 8058
  chunk IEND at offset 0x043bd, length 0
No errors detected in testflower.png (7 chunks, 92.7% compression).

【问题讨论】:

  • 尝试使用pngcheck -v testflower.pnggm identify -verbose testflower.png 检查您的图像并将输出粘贴到您的问题中。 gm identify -version 也可能有帮助。
  • 请参阅上面我的问题中的编辑。这些信息是什么意思?
  • 只是一种预感,理解调色板图像可能是个问题。如果您安装了 ImageMagick(以及 GraphicsMagick),您可以尝试将其转换为 RGB888 图像,而不是使用 convert testflower.png PNG24:flower.png 的调色板图像,看看它是否可以加载。
  • 如果您只有一个特殊的 png 有问题,您应该上传它并添加一个链接。其他带有img = imread("foo.png"); 的 png 和 jpeg 可以正常工作,对吧?
  • A = imread(filename); 有效!但是为什么A = importdata(filename); 不起作用呢?

标签: image matlab octave


【解决方案1】:

您可以忽略警告,因为 16 位 see here

您看到的错误来自图像(不是 importdata),显然是因为importdata 的返回值与您的 GNU Octave 版本中的image 不兼容(它适用于 5.x)

使用

img = imread ("test.png");
image (img)

改为

【讨论】:

  • 如果您能在这里简单地发布一下如何使用调试命令,那就太好了。
猜你喜欢
  • 2023-02-21
  • 2021-08-27
  • 1970-01-01
  • 2020-01-04
  • 2013-03-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-07-07
相关资源
最近更新 更多