We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to convert color tiff to black and white tiff files?

I have a color tiff files, i want to covert color to black and white (grayscale) for tiff files. i saw some forums which change color while convert from some other file format, but i want tif to tif only change color to black and white.

And also i need to change grayscale on specified pages, so i need to loop and change grayscale.


Please review

Binarize TIFF documents via .NET | products.aspose.com

Grayscale TIFF documents via .NET | products.aspose.com

to get an idea how to achive the goal.

You may avoid use new PngOptions() to save in the same format.

You may enumerate TiffImage Frames to manipulate particular pages.

Hi,i am using following code to make grayscale.
E.G: we have 3 pages tiff files,if i loop and make 2nd page only as grayscale, when output tiff file got as first page as grayscale.

Using image As TiffImage = Aspose.Imaging.Image.Load(“F:\AI\Fuad.tif”)

        For i As Integer = 0 To image.Frames.Length - 1

            If i = 2 Then
                image.ActiveFrame.SetPalette(ColorPaletteHelper.Create4BitGrayscale(True), True)
            End If

        image.Save(dataDir & "Fuad68.tif")
    End Using

Here how to grayscale the 2nd page or specific page.


Please review following c# code snippet to make second page in shades of gray:

using (Image image = Image.Load("multipage.tif"))
                var tiffImage = image as TiffImage;
                    for(int i=0;i< tiffImage.Frames.Length;i++)
                image.Save(Path.Combine( "multipage_out.tif");