PDFSharp.Extensions icon indicating copy to clipboard operation
PDFSharp.Extensions copied to clipboard

fix negated 1bpp TIFs with Photometric.MINISBLACK

Open ghosttie opened this issue 3 years ago • 3 comments

TIF images with Photometric.MINISBLACK are being extracted with their colors negated (white is black and black is white).

I think this is because TIFs with the Photometric tag set to MINISBLACK have their image data negated and System.Drawing.Bitmap doesn't appear to allow setting this, so it displays the data as-is, which is negated.

The only way I've found to fix this is to negate the image data in ImageFromCCITTFaxDecode if CCITTFaxDecodeParameters.BlackIs1 is false.

This should fix the issues complaining about this problem - #6 and #8

ghosttie avatar Mar 28 '22 21:03 ghosttie

Hi, I've got a modern fork github.com/Open-Inventions/PDFSharp.Extensions with ImageSharp and .NET 6 if you are interested.

husaft avatar Dec 09 '22 06:12 husaft

@husaft any chance of getting your fork as a NuGet package?

ghosttie avatar Dec 22 '22 23:12 ghosttie

@husaft any chance of getting your fork as a NuGet package?

Yes, it's now in https://www.nuget.org/packages/PdfSharpCore.Extensions !

husaft avatar Dec 26 '22 14:12 husaft