Пример #1
0
 private static void SetRotateInfo()
 {
     foreach (string s in Directory.GetFiles(@"..\..\..\testdata\pixrotate", "*"))
     {
         FileInfo fi  = new FileInfo(s);
         FIBITMAP?dib = ImageWorker.GetJPGImageHandle(fi);
         if (dib != null)
         {
             ImageWorker.SetRotateInfo((FIBITMAP)dib, 8);
             ImageWorker.SaveJPGImageHandle((FIBITMAP)dib, new FileInfo(fi.AugmentFilename("_rotinfo")));
         }
     }
 }
Пример #2
0
        /// <summary>
        /// this aquires and frees a freeimage bitmap handle
        /// see: http://sylvana.net/jpegcrop/exif_orientation.html
        /// </summary>
        /// <param name="fi">the file to rotate</param>
        /// <param name="extension">if you want a different filename, it can be extended</param>
        public static void AutoRotateImageFI(FileInfo fi, string extension)
        {
            string outname = fi.AugmentFilename(extension);
            ushort rotateme;

            if (GetRotInfo(fi, out rotateme))
            {
                bool imageWasChanged = DoLosslessRotation(fi, rotateme, outname);
                if (imageWasChanged)
                {
                    ResetRotationInfo(outname);
                }
            }
            else
            {
                // tell anyone?
            }
        }