Click here to Skip to main content
15,867,704 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,

I am in need of equivalent c# code below image magic command.

convert input.png -remap pattern:gray30 output.bmp


byte[] input = System.IO.File.ReadAllBytes(ImgPath + "1.JPG");

MagickReadSettings readSettings = new MagickReadSettings()
{
UseMonochrome = true,
Depth=1,
Density = new Density(300, 300, DensityUnit.PixelsPerInch)
};

using (MagickImage image = new MagickImage(input, readSettings))
{
...... ?
}

What I have tried:

byte[] input = System.IO.File.ReadAllBytes(ImgPath + "1.JPG");

            MagickReadSettings readSettings = new MagickReadSettings()
            {
                UseMonochrome = true,
                Depth=1,
                Density = new Density(300, 300, DensityUnit.PixelsPerInch)
            };

            using (MagickImage image = new MagickImage(input, readSettings))
            {
                   ...... ?
            }
Posted
Comments
BillWoodruff 3-Mar-21 15:55pm    
Use the dedicated ImageMagick section on StackOverflow ?

https://stackoverflow.com/questions/tagged/imagemagick
#realJSOP 3-Mar-21 17:01pm    
I think if you replace the "------ ?" with some actual code, it'll probably work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900