WPF を使用して画像ファイルに JPEG コメントを追加しようとしています。次のコードを試すと、ArgumentOutOfRangeException
. 他のプロパティの設定は問題なく機能します。
using (Stream read = File.OpenRead(@"my.jpeg"))
{
JpegBitmapDecoder decoder = new JpegBitmapDecoder(read, BitmapCreateOptions.None, BitmapCacheOption.None);
var meta = decoder.Frames[0].Metadata.Clone() as BitmapMetadata;
meta.SetQuery("/app1/ifd/exif:{uint=40092}", "xxx"); // works
meta.SetQuery("/com/TextEntry", "xxx"); // does not work
}
明確にするために、MSDN http://msdn.microsoft.com/en-us/library/windows/desktop/ee719904%28v=vs.85%29.aspxにリストされている /com/TextEntry フィールドを設定する必要があります。 #_jpeg_metadata
データは、このタグのみをサポートする別のアプリケーションによって読み取られるため、他の「コメント」フィールドを使用するオプションはありません。
何か案は?