Beispiel #1
0
        public static Exif LoadFromImage(string fileName)
        {
            if (string.IsNullOrEmpty(fileName))
            {
                return(null);
            }
            if (!System.IO.File.Exists(fileName))
            {
                return(null);
            }

            Exif ex = new Exif();

            using (System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(fileName))
            {
                foreach (System.Drawing.Imaging.PropertyItem pi in bmp.PropertyItems)
                {
                    ex.SetParameter(new ExifParams()
                    {
                        Id = pi.Id, Data = pi.Value, DataLen = pi.Len, Type = (ExifType)pi.Type
                    });
                }
                return(ex);
            }
            return(null);
        }