【问题标题】:System.Drawing.GDIPlus.CheckStatus System.Drawing.Image.FromFile System.ArgumentException [GDI+ status: InvalidParameter]System.Drawing.GDIPlus.CheckStatus System.Drawing.Image.FromFile System.ArgumentException [GDI+ 状态:无效参数]
【发布时间】:2018-01-03 17:12:54
【问题描述】:

实际上在 Raspberry PI 2 上。 $ unname -a Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux

$ mono --version Mono JIT 编译器版本 3.2.8 (Debian 3.2.8+dfsg-4+rpi1)

getImageFromFile=images/complex/complex C3.jpg
loadOverlayImages plant life loadImages
getImageFromFile=images/butterfly/animated-butterfly-image-0004.gif
fn=images/butterfly/animated-butterfly-image-0004.gif  targetDir=images/butterfly  PlantImage.GetFrameCount=5 for file:images/butterfly/animated-butterfly-image-0004.gif
getImageFromFile=images/butterfly/animated-butterfly-image-0005.gif
ERROR: getImageFromFile- System.ArgumentException: A null reference or invalid value was found [GDI+ status: InvalidParameter]
  at System.Drawing.GDIPlus.CheckStatus (Status status) [0x00000] in <filename unknown>:0
  at System.Drawing.Image.FromFile (System.String filename, Boolean useEmbeddedColorManagement) [0x00000] in <filename unknown>:0
  at System.Drawing.Image.FromFile (System.String filename) [0x00000] in <filename unknown>:0
  at PlantLifeAnimationForm.PlantLifeImagesService.getImageFromFile (System.String filePath) [0x00015] in     /home/pi/emgucv/PlantLifeAnimation/PlantLifeAnimationForm/model/PlantLifeImagesService.cs:223
fn=images/butterfly/animated-butterfly-image-0005.gif  targetDir=images/butterfly
Unhandled Exception:

此文件在 Windows 上运行良好(死在这里:System.Drawing.Image.FromFile(filePath)

            using (Bitmap temp = (Bitmap)System.Drawing.Image.FromFile(filePath))
            {
                bitmapSource = (Bitmap)temp.Clone();
            }

【问题讨论】:

    标签: .net mono raspberry-pi2


    【解决方案1】:

    查看这个单声道错误 - https://bugzilla.novell.com/show_bug.cgi?id=510805。 基本上,当 libgif 无法处理提供的 gif 时,他们所说的问题就会发生。例如,对于您的图像 gifinfo(它是 libgif-tools 包的一部分)说:

    图 8 不限于屏幕尺寸,已中止。

    我还必须警告您,如果您在单声道上进行任何严肃的图像处理 - 避免使用标准位图和相关类,它们在很多方面都是错误的(根据我自己的新鲜经验)。对于大多数图像处理,我直接使用 MagickWand C api(通过 p-invoke)。

    【讨论】:

    • 是的,很棒的发现,我在谷歌上搜索过,很棒的发现。 +1000 分所以我安装了:得到了相同的响应。修复GIF? & 底线:严格的 gif 规则导致它在位图上呕吐(使用 OPENCV Image 东西而不是它更稳定,根据需要转换 ToBitMap() 以显示?谢谢!$ sudo apt-get install giflib-tools $ gifinfo animated-butterfly-image-0005.gif Image 8 is not confined to screen dimension, aborted. pi@raspberrypi /butterfly $ gifinfo animated-butterfly-image-0004.gif Size: 148x149 Comment: FILE IDENTITY Created or modified by TAKASHI KUMON
    猜你喜欢
    • 1970-01-01
    • 2012-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-15
    • 2011-09-26
    • 1970-01-01
    相关资源
    最近更新 更多