Beispiel #1
0
 public EXIFMetaData(PropertyItem[] PropertyItems)
 {
     mEXIFPropertyItems = new EXIFPropertyItem[PropertyItems.Length];
     for (int i = 0; i < PropertyItems.Length; i++)
     {
         mEXIFPropertyItems[i] = new EXIFPropertyItem(PropertyItems[i]);
     }
 }
        public void AddCopyright(string text)
        {
            Bitmap bitmap = new Bitmap(new MemoryStream(mBitmap));

            if (bitmap.Width < ThumbnailSize.Width && bitmap.Height < ThumbnailSize.Height)
            {
                return;
            }

            Graphics     g     = Graphics.FromImage(bitmap);
            StringFormat Align = new StringFormat();

            Align.Alignment = StringAlignment.Center;

            float FontSize = (float)((bitmap.Height / bitmap.PhysicalDimension.Height) * 3);
            Font  Font     = new Font("Verdana", FontSize, FontStyle.Regular);

            Exif.EXIFPropertyItem ExifModel        = MetaData.GetItem(Exif.KnownEXIFIDCodes.Model);
            Exif.EXIFPropertyItem ExifManufacturer = MetaData.GetItem(Exif.KnownEXIFIDCodes.Manufacturer);
            Exif.EXIFPropertyItem ExifDateTime     = MetaData.GetItem(Exif.KnownEXIFIDCodes.DateTime);

            StringBuilder ExifData = new StringBuilder();

            if (ExifManufacturer != null && ExifModel != null)
            {
                if (ExifModel.ParsedString.Split(" ".ToCharArray(), 2)[0] == ExifManufacturer.ParsedString.Split(" ".ToCharArray(), 2)[0])
                {
                    ExifManufacturer = null;
                }
            }

            if (ExifManufacturer != null)
            {
                ExifData.Append(ExifManufacturer.ParsedString + " ");
            }
            if (ExifModel != null)
            {
                ExifData.Append(ExifModel.ParsedString + " ");
            }
            if (ExifDateTime != null)
            {
                ExifData.Append(ExifDateTime.ParsedDate.ToString("yyyy/MM/dd") + " ");
            }
            if (text != null)
            {
                ExifData.Append(text + " ");
            }

            if (ExifData.Length > 0)
            {
                SizeF ExifSize = g.MeasureString(ExifData.ToString(), Font);

                g.DrawString(
                    ExifData.ToString(),
                    Font,
                    Brushes.Black,
                    bitmap.Size.Width - ExifSize.Width - 3,
                    bitmap.Size.Height - ExifSize.Height - 1);

                g.DrawString(
                    ExifData.ToString(),
                    Font,
                    Brushes.Silver,
                    bitmap.Size.Width - ExifSize.Width - 4,
                    bitmap.Size.Height - ExifSize.Height - 1);
            }

            mBitmap = GetJpegBits(bitmap, 100);
        }
Beispiel #3
0
 public EXIFMetaData(PropertyItem[] PropertyItems)
 {
     mEXIFPropertyItems = new EXIFPropertyItem[PropertyItems.Length];
     for (int i = 0; i < PropertyItems.Length; i++)
     {
         mEXIFPropertyItems[i] = new EXIFPropertyItem(PropertyItems[i]);
     }
 }