I'm converting a pdf to images and wanto convert these to black/white.
It is working to get a grayscale output but I cannot find how to get 1 bit images.
Code used
Code: Select all
MagickReadSettings settings = new MagickReadSettings();
// Settings the density to 300 dpi will create an image with a better quality
PointD xx = new PointD(300, 300);
settings.Density = xx;
using (MagickImageCollection images = new MagickImageCollection())
{
// Add all the pages of the pdf file to the collection
images.Read(@"D:\Projects\imagemagick\pdfs\outofmem.pdf", settings);
int page = 1;
foreach (MagickImage image in images)
{
// Write page to file that contains the page number
image.ColorSpace = ColorSpace.Gray;
image.Write(@"D:\Projects\imagemagick\pdfs\" + "outofmem.Page" + page + ".jpg");
page++;
}
}
tx