ImageSharp "Does not support this kind of bitmap files"

Created on 11 Oct 2018  路  6Comments  路  Source: SixLabors/ImageSharp

Prerequisites

  • [x] I have written a descriptive issue title
  • [x] I have verified that I am running the latest version of ImageSharp
  • [x] I have verified if the problem exist in both DEBUG and RELEASE mode
  • [x] I have searched open and closed issues to ensure it has not already been reported

Description

Trying to open a specific bitmap file created with Magick.NET fails with an exception. Other files created in the same way don't.

Selecting ImageMagick.MagickFormat.Bmp2 or ImageMagick.MagickFormat.Bmp3 resolves the issue. The issue is with ImageMagick.MagickFormat.Bmp specifically, which uses, according to the docs, version 4 of the format.

The image in question _does_ open without issues in other Windows programs (Paint, Photos, Photoshop) and Dropbox.

Steps to Reproduce

Download the file.

Try to open it:

using (var image = Image.Load("bitmap.bmp"))
{}

generates

Exception has occurred: CLR/System.NotSupportedException
An unhandled exception of type 'System.NotSupportedException' occurred in SixLabors.ImageSharp.dll: 'Does not support this kind of bitmap files.'
   at SixLabors.ImageSharp.Formats.Bmp.BmpDecoderCore.Decode[TPixel](Stream stream)
   at SixLabors.ImageSharp.Image.Decode[TPixel](Stream stream, Configuration config)
   at SixLabors.ImageSharp.Image.WithSeekableStream[T](Configuration config, Stream stream, Func`2 action)
   at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, Stream stream, IImageFormat& format)
   at SixLabors.ImageSharp.Image.Load[TPixel](Configuration config, String path)

System Configuration

  • ImageSharp version: 1.0.0-beta0005
  • Environment (Operating system, version and so on): Windows 10 x64 1803
  • .NET Framework version: 4.7.2 / .NET Core 2.1.4
enhancement bmp

Most helpful comment

@brianpopow fixed the link. Don't know what happened there.

All 6 comments

@wc-matteo

Yeah, bitmap support covers the more common types so far. @dlemstra Is there code we can use as inspiration from ImageMagick?

I think we should be able to add support for this. And the file coders/bmp.c could give some insight on how this is done in ImageMagick.

That's good news! 馃帀

If we update the support listed in #320 we can fix this

@wc-matteo: would you mind sharing the image here again? The drop box link does not work anymore. Just attaching it to this ticket would be helpful to reproduce it.

@brianpopow fixed the link. Don't know what happened there.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artem-avanesov picture artem-avanesov  路  3Comments

marcpabst picture marcpabst  路  3Comments

olivif picture olivif  路  3Comments

vad3x picture vad3x  路  4Comments

vinhhrv picture vinhhrv  路  3Comments