public static void Run()
        {
            // ExStart:CreateThumbnailsFromPSDFiles
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            // Load a PSD in an instance of PsdImage
            using (PsdImage image = (PsdImage)Image.Load(dataDir + "sample.psd"))
            {
                // Iterate over the PSD resources
                foreach (var resource in image.ImageResources)
                {
                    // Check if the resource is of thumbnail type
                    if (resource is ThumbnailResource)
                    {
                        // Retrieve the ThumbnailResource and Check the format of the ThumbnailResource
                        var thumbnail = (ThumbnailResource)resource;
                        if (thumbnail.Format == ThumbnailFormat.KJpegRgb)
                        {
                            // Create a new BmpImage by specifying the width and height,  Store the pixels of thumbnail on to the newly created BmpImage and save image
                            BmpImage thumnailImage = new BmpImage(thumbnail.Width, thumbnail.Height);
                            thumnailImage.SavePixels(thumnailImage.Bounds, thumbnail.ThumbnailData);
                            thumnailImage.Save(dataDir + "CreateThumbnailsFromPSDFiles_out.bmp");
                        }
                    }
                }
            }
            // ExEnd:CreateThumbnailsFromPSDFiles
        }
        public static void Run()
        {
            //ExStart:ExportImageToPSD
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            // Create a new image from scratch.
            using (BmpImage bmpImage = new BmpImage(300, 300))
            {
                // Fill image data.
                Graphics graphics = new Graphics(bmpImage);
                graphics.Clear(Color.White);
                var pen = new Pen(Color.Brown);
                graphics.DrawRectangle(pen, bmpImage.Bounds);

                // Create an instance of PsdOptions, Set it's various properties Save image to disk in PSD format
                PsdOptions psdOptions = new PsdOptions();
                psdOptions.ColorMode         = ColorModes.Rgb;
                psdOptions.CompressionMethod = CompressionMethod.Raw;
                psdOptions.Version           = 4;
                bmpImage.Save(dataDir + "ExportImageToPSD_output.psd", psdOptions);
            }

            //ExEnd:ExportImageToPSD
        }
        public static void Run()
        {
            // ExStart:CreateThumbnailsFromPSDFiles
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            // Load a PSD in an instance of PsdImage
            using (PsdImage image = (PsdImage)Image.Load(dataDir + "sample.psd"))
            {
                // Iterate over the PSD resources
                foreach (var resource in image.ImageResources)
                {
                    // Check if the resource is of thumbnail type
                    if (resource is ThumbnailResource)
                    {
                        // Retrieve the ThumbnailResource and Check the format of the ThumbnailResource
                        var thumbnail = (ThumbnailResource)resource;                       
                        if (thumbnail.Format == ThumbnailFormat.KJpegRgb)
                        {
                            // Create a new BmpImage by specifying the width and height,  Store the pixels of thumbnail on to the newly created BmpImage and save image
                            BmpImage thumnailImage = new BmpImage(thumbnail.Width, thumbnail.Height);
                            thumnailImage.SavePixels(thumnailImage.Bounds, thumbnail.ThumbnailData);
                            thumnailImage.Save(dataDir + "CreateThumbnailsFromPSDFiles_out.bmp");
                        }
                    }
                }
            }
            // ExEnd:CreateThumbnailsFromPSDFiles
        }
示例#4
0
        static void Extract(string filename)
        {
            string fname = System.IO.Path.GetFileNameWithoutExtension(filename);

            Binary file    = new Binary(filename);
            long   sectors = file.Length / SECTOR_SIZE;

            Console.WriteLine("{0} BYTES, {1} SECTORS", file.Length, sectors);

            A1R5G5B5Image screen = new A1R5G5B5Image(640, 480);
            BmpImage      image  = new BmpImage(640, 480);
            Binary        sector;

            for (int i = 0; i < sectors; i++)
            {
                Console.WriteLine("Extracting SECTOR {0}", i);
                sector = new Binary(file[SECTOR_SIZE * i, SECTOR_SIZE]);
                screen.Read(sector);
                image.SetPixels(screen.Pixels);

                image.Save(string.Format(fname + "_{0:000}.bmp", i));
            }

            Console.WriteLine("Done!");
        }
示例#5
0
        public int ExeGraphCompare(int[] lXferData, string[] lXferFile, ref string Msg, ref bool Result, int Line)
        {
            Bitmap BmpImage;
            int    ret = 0;

            if (lXferData.Length > 0)
            {
                WarnResult(IMGCMPTOKEN, NOPARAMETER, ref Msg, Line);
            }
            if (lXferFile.Length < 3)
            {
                Result = false; ErrResult(IMGCMPTOKEN, NOPARAMETER, ref Msg, Line); return(SystemInfo.ERROR_CMP_NOPARAM);
            }
            SL_Img_Lib CmpImg = new SL_Img_Lib(lXferFile[0]);

            ret = CmpImg.CompareGrpah(lXferFile[1], ref Msg, ref lCmpInfo);

            if (ret == SystemInfo.ERROR_CMP_FILENOTEXIST)
            {
                WarnResult(IMGCMPTOKEN, FILENOTEXIST, ref Msg, Line);
            }
            else if (ret == SystemInfo.ERROR_CMP_ERROR)
            {
                CmpImg.SaveTxtResult(lXferFile[2], ref lCmpInfo, true);
                BmpImage = CmpImg.getResultBmp();
                BmpImage.Save(lXferFile[2]);
                WarnResult(IMGCMPTOKEN, BMPCMPNOTMATCH, ref Msg, Line);
            }
            else
            {
                WarnResult(IMGCMPTOKEN, BMPCMPMATCH, ref Msg, Line);
            }

            return(Chip.ERROR_RESULT_OK);
        }
        private void BuildScreen()
        {
            var screenLeft = _monitor.Bounds.Left;
            var screenTop  = _monitor.Bounds.Top;

            using (var g = Graphics.FromImage(BmpImage))
                g.CopyFromScreen(screenLeft, screenTop, 0, 0, BmpImage.Size);
            using (var stream = new MemoryStream()) {
                BmpImage.Save(stream, ImageFormat.Png);
                _pictureBoxContainer.Image = BmpImage;
            }
        }
示例#7
0
        public static void Run()
        {
            //ExStart:BMPToPDF

            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            using (BmpImage image = (BmpImage)Image.Load(dataDir))
            {
                Aspose.Imaging.ImageOptions.PdfOptions exportOptions = new PdfOptions();
                exportOptions.PdfDocumentInfo = new Aspose.Imaging.FileFormats.Pdf.PdfDocumentInfo();

                image.Save(dataDir, exportOptions);
            }
        }
示例#8
0
        public static void Run()
        {
            Console.WriteLine("Running example BMPToPDF");
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            using (BmpImage image = (BmpImage)Image.Load(System.IO.Path.Combine(dataDir, "sample.bmp")))
            {
                Aspose.Imaging.ImageOptions.PdfOptions exportOptions = new PdfOptions();
                exportOptions.PdfDocumentInfo = new Aspose.Imaging.FileFormats.Pdf.PdfDocumentInfo();

                image.Save(System.IO.Path.Combine(dataDir, "sample_out.pdf"), exportOptions);
            }

            Console.WriteLine("Finished example BMPToPDF");
        }
示例#9
0
        public static void Run()
        {
            Console.WriteLine("Running example ExtractTIFFFramesToBMPImageFormat");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            using (TiffImage multiImage = (TiffImage)Image.Load(dataDir + "SampleTiff1.tiff"))
            {
                // Create an instance of int to keep track of frames in TiffImage
                int frameCounter = 0;

                // Iterate over the TiffFrames in TiffImage
                foreach (TiffFrame tiffFrame in multiImage.Frames)
                {
                    multiImage.ActiveFrame = tiffFrame;

                    // Load Pixels of TiffFrame into an array of Colors
                    Color[] pixels = multiImage.LoadPixels(tiffFrame.Bounds);

                    // Create an instance of bmpCreateOptions
                    BmpOptions bmpCreateOptions = new BmpOptions();
                    bmpCreateOptions.BitsPerPixel = 24;

                    // Set the Source of bmpCreateOptions as FileCreateSource by specifying the location where output will be saved
                    bmpCreateOptions.Source = new FileCreateSource(string.Format("{0}\\ConcatExtractTIFFFramesToBMP_out{1}.bmp", dataDir, frameCounter), false);

                    // Create a new bmpImage
                    using (BmpImage bmpImage = (BmpImage)Image.Create(bmpCreateOptions, tiffFrame.Width, tiffFrame.Height))
                    {
                        // Save the bmpImage with pixels from TiffFrame
                        bmpImage.SavePixels(tiffFrame.Bounds, pixels);
                        bmpImage.Save();
                    }
                    frameCounter++;
                }
            }

            Console.WriteLine("Finished example ExtractTIFFFramesToBMPImageFormat");
        }