Convert PDF to black and white (1bit) PNG #972
-
One of our customers need to convert PDF shipping labels to PNG images. The PDF images need to be 300 DPI and have a bit depth of 1 (pure black and white without grayscale). I have got this working but with some issues that i can not find any solution for. My Code
Result When this code is run with the following setup (BitDepth(1) + 300 DPI) the PNG image is 1169x2303 and (4Bit depth). When this code is run with the following setup (Removed BitDepth(1) + 300 DPI) the PNG image is 1169x2303 and (32Bit depth). This gives me 2 primary issues, when BitDepth is set to 1 why is the PNG image still 4bit? Second the quality of that 4bit image is horrible and unreadable by a barcode scanner. It feels like the image is somehow being resized during the writing process. I would need to have the "sharpness" of the 32 bit image but as 1 bit. Could someone point me in the right direction here, feels like i am lacking the knowhow of image conversion. Thank you! PS: I'm using Magick.NET-Q8-AnyCPU (7.23.3) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What happens when you do |
Beta Was this translation helpful? Give feedback.
What happens when you do
horizontal.ColorType = ColorType.Bilevel;
?