Skip to content

bmp written is not supported by Chrome or Firefox #886

Closed

Description

Prerequisites

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

Description

When saving image as bmp it can not be seen with Chrome or Firefox, however it can be read by MS Paint.

This started to happen with 1.0.0-beta0006 when i compare the produced image with one from 1.0.0-beta0005 i can see that the bmp header is different....

images.zip

Steps to Reproduce

using (var image = Image.Load<Rgb24>(mem))
{
    // issue here
    image.SaveAsBmp(fullMem);
}

System Configuration

Seen under Windows and Linux

  • ImageSharp version: 1.0.0-beta0006
  • Other ImageSharp packages and versions:
  • Environment (Operating system, version and so on):
  • .NET Framework version:
  • Additional information:

Activity

  1. ghost changed the title [-]bmp written is not suppprted by Chrome or Firefox[/-] [+]bmp written is not suppported by Chrome or Firefox[/+] on Apr 16, 2019
  2. ghost changed the title [-]bmp written is not suppported by Chrome or Firefox[/-] [+]bmp written is not supported by Chrome or Firefox[/+] on Apr 16, 2019
  3. JimBobSquarePants commented on Apr 17, 2019

    @JimBobSquarePants
    Member

    Odd. V4 bitmaps should be supported. @brianpopow do you have any insight here?

    http://entropymine.com/jason/bmpsuite/bmpsuite/html/bmpsuite.html

  4. brianpopow commented on Apr 17, 2019

    @brianpopow
    Collaborator

    we have indeed changed the bitmap header in beta0006 to V4 to support bitmaps with transparency. As @JimBobSquarePants said, chrome and firefox should support those.

    I checked the imagesharp bitmap encoder and at first glance i can not spot an error.
    I was thinking maybe we should write V3 bitmap header as default and keep writing V4 headers as optional. I will look further into this the next days.

  5. JimBobSquarePants commented on Apr 18, 2019

    @JimBobSquarePants
    Member

    Thanks @brianpopow appreciate it! That sounds like a sensible plan.

  6. brianpopow commented on Apr 18, 2019

    @brianpopow
    Collaborator

    The v4 header does not seem to be the issue here. It seems to be combination of V4 header + 24 bits per pixel + Bitfields compression which chrome and firefox does not like. Bitfields with 32 bits per pixel does work with chrome, firefox and irfanview.

    @pammann-work: as i said in my first post. The intention for using V4 header (with Bitfields) was to support transparency, but in your case with 24 bpp, there is no transparency anyway. Your hack for changing from bitfields (0x03) to no compression (0x00) works, because we use 8 bit per color channel with bitfields. This is essentially the same as uncompressed (without transparency).
    I wanted to change the bitmap header to default to V3, which implies no compression. V3 headers should be supported by almost all decoders.

  7. added this to the 1.0.0-rc1 milestone on May 1, 2019
  8. JimBobSquarePants commented on May 1, 2019

    @JimBobSquarePants
    Member

    Fixed with #889

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions