public static void InterruptMonitor(string dir, string ouputDir)
        {
            ImageOptionsBase saveOptions = new ImageOptions.PngOptions();

            Multithreading.InterruptMonitor monitor = new Multithreading.InterruptMonitor();
            SaveImageWorker worker = new SaveImageWorker(dir + "big.psb", dir + "big_out.png", saveOptions, monitor);

            System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(worker.ThreadProc));

            try
            {
                thread.Start();

                // The timeout should be less than the time required for full image conversion (without interruption).
                System.Threading.Thread.Sleep(3000);

                // Interrupt the process
                monitor.Interrupt();
                System.Console.WriteLine("Interrupting the save thread #{0} at {1}", thread.ManagedThreadId, System.DateTime.Now);

                // Wait for interruption...
                thread.Join();
            }
            finally
            {
                // If the file to be deleted does not exist, no exception is thrown.
                System.IO.File.Delete(dir + "big_out.png");
            }
        }
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Aspose.Imaging.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Load an existing image
            using (Image image = Image.Load(dataDir + "sample.psd"))
            {
                var psdImage = (FileFormats.Psd.PsdImage)image;
                var pngOptions = new ImageOptions.PngOptions();
                pngOptions.ColorType = FileFormats.Png.PngColorType.TruecolorWithAlpha;

                for (int i = 0; i < psdImage.Layers.Length; i++)
                {
                    psdImage.Layers[i].Save(dataDir + "layer-" + i +".png", pngOptions);
                }
            }
        }
        public static void Main()
        {
            // The path to the documents directory.
            string dataDir = Aspose.Imaging.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Load an existing image
            using (Image image = Image.Load(dataDir + "sample.psd"))
            {
                var psdImage   = (FileFormats.Psd.PsdImage)image;
                var pngOptions = new ImageOptions.PngOptions();
                pngOptions.ColorType = FileFormats.Png.PngColorType.TruecolorWithAlpha;

                for (int i = 0; i < psdImage.Layers.Length; i++)
                {
                    psdImage.Layers[i].Save(dataDir + "layer-" + i + ".png", pngOptions);
                }
            }
        }