Aspose.Imaging.Examples.CSharp.ModifyingAndConvertingImages.BinarizationWithFixedThreshold.Run C# (CSharp) Метод

Run() публичный статический Метод

public static Run ( ) : void
Результат void
        public static void Run()
        {
            // ExStart:BinarizationWithFixedThreshold
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            // Load an image in an instance of Image
            using (Image image = Image.Load(dataDir + "aspose-logo.jpg"))
            {
                // Cast the image to RasterCachedImage and Check if image is cached                
                RasterCachedImage rasterCachedImage = (RasterCachedImage)image;
                if (!rasterCachedImage.IsCached)
                {
                    // Cache image if not already cached
                    rasterCachedImage.CacheData();
                }

                // Binarize image with predefined fixed threshold and Save the resultant image                
                rasterCachedImage.BinarizeFixed(100);
                rasterCachedImage.Save(dataDir + "BinarizationWithFixedThreshold_out.jpg");
            }
            // ExEnd:BinarizationWithFixedThreshold
        }
    }
BinarizationWithFixedThreshold