Related blog post: Convert PDF to Grayscale Images in C#
Last active
March 22, 2022 10:07
-
-
Save GroupDocsGists/3e3c9f756ece5d6f94f90603ec2798bd to your computer and use it in GitHub Desktop.
Convert Document to Grayscale Images in C#
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert PDF to Grayscale JPG in C# | |
using (Converter converter = new Converter("path/document.pdf")) | |
{ | |
ImageConvertOptions options = new ImageConvertOptions | |
{ | |
Format = ImageFileType.Jpg, | |
Grayscale = true, | |
// Aditional Conversion Options | |
Height = 1024, | |
Width = 1024, | |
FlipMode = ImageFlipModes.FlipX, | |
RotateAngle = 90, | |
/* | |
Brightness = 50,// Brightness | |
Gamma = 0.5F, // Gamma Settings | |
Contrast = 50 // Contrast | |
*/ | |
}; | |
converter.Convert("path/grayscaleDocument.jpg", options); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert PDF to Grayscale PNG in C# | |
using (Converter converter = new Converter("path/document.pdf")) | |
{ | |
ImageConvertOptions options = new ImageConvertOptions | |
{ | |
Format = ImageFileType.Png, | |
Grayscale = true | |
}; | |
converter.Convert("path/grayscaleDocument.png", options); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment