convert a selected image to BW Grayscale

How i can convert an selected image in corelDraw to an BW Grayscale image ?

I have try this code, but it not works.

-Remo

1
2
3
4
5
6
7
private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            corelApp.ActiveSelection.Shapes.All().CreateSelection();
            Image testImage = (Image)corelApp.ActiveSelection.ConvertToBitmap(24, true, true, true, 500, corel.cdrAntiAliasingType.cdrNormalAntiAliasing, true, false, false, 95);

            //void ConvertToBW(cdrRenderType RenderType, int Intensity = 100, int Threshold = 128, cdrHalftoneType Halftone = cdrHalftoneSquare, int HalftoneAngle = 45, int HalftoneSize = 0);
        }
Parents
  • First, I would use ConvertToBitmapEx. Second, it return a Shape not an Image. So something like this:

                corelApp.ActiveSelection.Shapes.All().CreateSelection();
                corel.Shape testImage = corelApp.ActiveSelection.ConvertToBitmapEx(corel.cdrImageType.cdrGrayscaleImage, true, true, 500, corel.cdrAntiAliasingType.cdrNormalAntiAliasing, true, false, 95);
    

    Happy coding, 

    -Shelby

Reply Children