Skip to content

Images saved using Pbm Binary Byte format (P4) are corrupted.  #2477

@danzk

Description

@danzk

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

ImageSharp version

3.0.1

Other ImageSharp packages and versions

3.0.1

Environment (Operating system, version and so on)

Windows 10

.NET Framework version

6.0

Description

Images saved using Pbm Binary Byte format (P4) are corrupted.
It seems like the file written is too short and if you try to open it in GIMP it will say it's corrupted.
Reloading the saved file and saving to a different format you can see it is visibly corrupted.
I have tried a few different images and they all have the same issue.

Steps to Reproduce

`
var image = Image.Load("input.png");
var encoder = new PbmEncoder()
{
ColorType = PbmColorType.BlackAndWhite,
ComponentType = PbmComponentType.Byte,
Encoding = PbmEncoding.Binary
};
image.Save("output.pbm", encoder);
var output = Image.Load("output.pbm");
output.SaveAsPng("output.png");

`

Images

input
output
output.zip
outputImageMagick.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions