Ejemplo n.º 1
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            FloatMapImage hdrImageToSave = outputHdrImage;
            Bitmap        ldrImageToSave = outputLdrImage;

            if ((outputLdrImage == null) || (outputHdrImage == null))
            {
                hdrImageToSave = inputHdrImage;
                ldrImageToSave = inputLdrImage;
            }

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Title        = "Save output file";
            sfd.Filter       = "PNG Files|*.png|PFM Files|*.pfm|JPEG Files|*.jpg";
            sfd.AddExtension = true;
            sfd.FileName     = "";
            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (sfd.FileName.EndsWith(".pfm"))
            {
                PortableFloatMap.SaveImage(hdrImageToSave, sfd.FileName);
            }
            else if (sfd.FileName.EndsWith(".png"))
            {
                ldrImageToSave.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Png);
            }
            else if (sfd.FileName.EndsWith(".jpg"))
            {
                ldrImageToSave.Save(sfd.FileName, System.Drawing.Imaging.ImageFormat.Jpeg);
            }
        }
Ejemplo n.º 2
0
        private static void ReadAndWriteTestImage(string filename)
        {
            Console.WriteLine("Writing a test image.");
            FloatMapImage image = CreateTestImage();

            DisplayInfo(image);
            PrintImageContents(image);
            PortableFloatMap.SaveImage(image, filename);
            Console.WriteLine();

            Console.WriteLine("Reading a test image.");
            FloatMapImage loadedImage = PortableFloatMap.LoadImage(filename);

            DisplayInfo(loadedImage);
            PrintImageContents(loadedImage);
        }
Ejemplo n.º 3
0
        private static void ReadAndWriteExistingImage(string filename)
        {
            Console.WriteLine("Reading an existing image.");
            FloatMapImage image = PortableFloatMap.LoadImage(filename);

            DisplayInfo(image);
            Console.WriteLine();

            Console.WriteLine("Writing a copy of an existing image.");
            string copyFilename = filename + ".out";

            PortableFloatMap.SaveImage(image, copyFilename);
            Console.WriteLine("Reading a copy of an existing image.");
            FloatMapImage loadedImage = PortableFloatMap.LoadImage(copyFilename);

            DisplayInfo(loadedImage);
        }