Beispiel #1
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:BinarizationWithFixedThreshold

            String sourceFile = dataDir + @"sample.psd";
            string destName   = dataDir + @"BinarizationWithFixedThreshold_out.jpg";

            // Load an image
            using (Image image = Image.Load(sourceFile))
            {
                // 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(destName, new JpegOptions());
            }

            //ExEnd:BinarizationWithFixedThreshold
        }
Beispiel #2
0
        public static void Run()
        {
            // To get proper output please apply a valid Aspose.Imaging License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
            // 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
                RasterCachedImage rasterCachedImage = (RasterCachedImage)image;
                // Check if image is cached
                if (!rasterCachedImage.IsCached)
                {
                    // Cache image if not already cached
                    rasterCachedImage.CacheData();
                }
                // Binarize image with predefined fixed threshold
                rasterCachedImage.BinarizeFixed(100);
                // Save the resultant image
                rasterCachedImage.Save(dataDir + "BinarizationWithFixedThreshold_out.jpg");
            }
            // ExEnd:BinarizationWithFixedThreshold
        }
        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
        }