5

While trying to save an image with my software name set in metadata I get exception "The designated BitmapEncoder does not support global metadata."

How can I achieve this?

using (Stream stream = File.Create(@"D:\Yourfile.png"))
{
        RenderTargetBitmap rtb = new RenderTargetBitmap(600, 400, 300, 300, PixelFormats.Pbgra32);
        DrawingVisual dv = new DrawingVisual();
        //draw on drawing visual
        rtb.Render(dv);

        BitmapEncoder encoder = null; 
        BitmapMetadata metadata = null; 

        encoder = new JpegBitmapEncoder();
        ((JpegBitmapEncoder)encoder).QualityLevel = 90;
        metadata = new BitmapMetadata("jpg");
        metadata.ApplicationName = "My Software Name";
        encoder.Metadata = metadata;
        BitmapFrame bitmapFrame = BitmapFrame.Create(rtb);
        encoder.Frames.Add(bitmapFrame);
        encoder.Save(stream);
}
AmaltasCoder
  • 1,123
  • 3
  • 17
  • 35

1 Answers1

-1

On this url http://code.google.com/p/exif-utils/ you can find a API for image

Byron
  • 301
  • 5
  • 21