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

            // Load a Jpeg image from file path location or stream
            using (JpegImage image = (JpegImage)Image.Load(dataDir + "aspose-logo.jpg"))
            {
                // Perform the automatic rotation on the image depending on the orientation data stored in the EXIF
                image.AutoRotate();
                // Save the result on disc or stream
                image.Save(dataDir + "aspose-logo_out.jpg");
            }
        }
Esempio n. 2
0
        public static void Run()
        {
            //ExStart:AutoCorrectOrientationOfJPEGImages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_JPEG();

            Console.WriteLine("Running example AutoCorrectOrientationOfJPEGImages");
            // Load a Jpeg image from file path location or stream
            using (JpegImage image = (JpegImage)Image.Load(dataDir + "aspose-logo.jpg"))
            {
                // Perform the automatic rotation on the image depending on the orientation data stored in the EXIF and  Save the result on disc or stream
                image.AutoRotate();
                image.Save(dataDir + "aspose-logo_out.jpg");
            }

            Console.WriteLine("Finished example AutoCorrectOrientationOfJPEGImages");
            //ExEnd:AutoCorrectOrientationOfJPEGImages
        }
        public static void Run()
        {
            //ExStart:AutoCorrectOrientationOfJPEGImages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            // Load PSD image.
            using (PsdImage image = (PsdImage)Image.Load(dataDir + "1280px-Zebras_Serengeti.psd"))
            {
                // Iterate over resources.
                foreach (var resource in image.ImageResources)
                {
                    // Find thumbnail resource. Typically they are in the Jpeg file format.
                    if (resource is ThumbnailResource || resource is Thumbnail4Resource)
                    {
                        // Adjust thumbnail data.
                        var thumbnail = (ThumbnailResource)resource;
                        var exifData  = thumbnail.JpegOptions.ExifData;
                        if (exifData != null && exifData.Thumbnail != null)
                        {
                            // If there is thumbnail stored then auto-rotate it.
                            JpegImage jpegImage = exifData.Thumbnail as JpegImage;
                            if (jpegImage != null)
                            {
                                jpegImage.AutoRotate();
                            }
                        }
                    }
                }

                // Save image.
                image.Save();
            }

            //ExEnd:AutoCorrectOrientationOfJPEGImages
        }