dlemstra / Magick.NET

The .NET library for ImageMagick
Apache License 2.0
3.43k stars 413 forks source link

Scanned Color PDF does not converted to Black and White images, rather converted into original color image with Monochrome as TRUE #1663

Closed SakthivelArumugam1 closed 2 months ago

SakthivelArumugam1 commented 3 months ago

Magick.NET version

13.2.0

Environment (Operating system, version and so on)

Windows Server 2016 Standard 64 bit OS x64 based processor

Description

We are using Imagemagic and Ghostscript to convert digital/scanned pdf to images. In Windows Environment, scanned color PDF was converted to original color images. But with Monochrome as TRUE should convert color PDF to black and white images. Why it was not converted to black and white images?

Below are the details and settings:

Magick.NET-Q8-x64 - 13.2.0 Magick.NET.Core - 13.2.0 GPL Ghostscript - 10.00.0

Imagemagic Settings: Density: 300 Image Width: 1500 Image Height: 1500 Monochrome: true Image Format: jpg

In Linux, we have installed same Ghostscript version 10.00.0. With Image magic version and setting, scanned color PDF was converted to black and white grey based images(NOT original color).

Probelm Statement: In Windows Environment, scanned color PDF was converted to original color images. But with Monochrome as TRUE should convert color PDF to black and white images. Why it was not considered Monochrome setting? Is there any limitation or some windows settings is causing this issue?

Steps to Reproduce

Have same set of environment like windows, imagemagic, magic.net, ghostscript. Provide a color scanned pdf to Imagemagic conversion. Validate the converted images. Expected is to convert to black and white / grey based images. But we are receiving same original color images.

dlemstra commented 3 months ago

Your issue contains not enough information that I can use to reproduce your issue. Please create a small code sample that explains what you are doing. I suspect that you are not passing the option from the command line correctly in code?

SakthivelArumugam1 commented 3 months ago

Input PDF on the left side and Output Image on the right side... InputPDF_OutputImage

Sample code snip CodeSnip Hi, added sample code snip, input pdf and output image. Hope this will help you understand the problem.

dlemstra commented 3 months ago

Next time please upload the actual .pdf file and include the code instead of taking a picture of your monitor. This makes it much more difficult for me to reproduce your issue. Lucky I had a file on my machine that I could use for testing.

But it does turn out that you found a bug inside Magick.NET. This required me to make some changes to ImageMagick. In the next release you will get a grayscale image instead.