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

Hi,
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.

Regards
Aravind

@branchu
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
        Next

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

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

Regards,
Aravind

@branchu
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;
                if(tiffImage!=null)
                {
                    for(int i=0;i< tiffImage.Frames.Length;i++)
                    {
                        if(i==1)
                        {
                            tiffImage.Frames[i].Grayscale();
                        }
                    }
                }
                image.Save(Path.Combine( "multipage_out.tif");
            }