Beispiel #1
0
        /// <summary>Returns Orientation from the EXIF data of a jpg.</summary>
        public static int GetDefaultRotationFromEXIF(string fileName)
        {
            if (!(GetExtension(fileName).Equals("jpg") || GetExtension(fileName).Equals("jpeg")))
            {
                return(0);
            }
            gma.Drawing.ImageInfo.Info info = new gma.Drawing.ImageInfo.Info(fileName);
            try
            {
                switch (info.Orientation.ToString())
                {
                case "RightTop": return(90);

                case "BottomLeft": return(180);

                case "LeftBottom": return(270);

                default: return(0);
                }
            }
            catch (Exception)
            {
                return(0);
            }
        }
Beispiel #2
0
        public static string GetDefImageAttribution(Image _image)
        {
            string rc = "";

            gma.Drawing.ImageInfo.Info pInfo = new gma.Drawing.ImageInfo.Info();

            pInfo.Image = _image;

            if (pInfo.Copyright.Length > 0)
            {
                rc += "(c)" + pInfo.Copyright;
            }
            if (pInfo.DTOrig.Length > 0)
            {
                rc += " " + pInfo.DateTime;
            }
            if (pInfo.DateTime.Length > 0)
            {
                rc += " " + pInfo.DTOrig;
            }
            if (pInfo.EquipMake.Length > 0)
            {
                rc += ": " + pInfo.EquipMake;
            }
            if (pInfo.EquipModel.Length > 0)
            {
                rc += " " + pInfo.EquipModel;
            }
            return(rc);
        }
 /// <summary>Returns Orientation from the EXIF data of a jpg.</summary>
 public static int GetDefaultRotationFromEXIF(string fileName)
 {
     if (!(GetExtension(fileName).Equals("jpg") || GetExtension(fileName).Equals("jpeg")))
         return 0;
     gma.Drawing.ImageInfo.Info info = new gma.Drawing.ImageInfo.Info(fileName);
     try
     {
         switch (info.Orientation.ToString())
         {
             case "RightTop": return 90;
             case "BottomLeft": return 180;
             case "LeftBottom": return 270;
             default: return 0;
         }
     }
     catch (Exception)
     {
         return 0;
     }
 }