InPlaceBitmapMetadataWriter.TrySave()返回true,但什么都不做 [英] InPlaceBitmapMetadataWriter.TrySave() returns true but does nothing
问题描述
在一些.JPG文件(EPS预览,由Adobe Illustrator中产生)在Windows 7 InPlaceBitmapMetadataWriter.TrySave()后,一些SetQuery()调用,但不执行任何返回true。
On some .JPG files (EPS previews, generated by Adobe Illustrator) in Windows 7 InPlaceBitmapMetadataWriter.TrySave() returns true after some SetQuery() calls, but does nothing.
代码示例:
BitmapDecoder decoder;
BitmapFrame frame;
BitmapMetadata metadata;
InPlaceBitmapMetadataWriter writer;
decoder = BitmapDecoder.Create(s, BitmapCreateOptions.PreservePixelFormat | BitmapCreateOptions.IgnoreColorProfile, BitmapCacheOption.Default);
frame = decoder.Frames[0];
metadata = frame.Metadata as BitmapMetadata;
writer = frame.CreateInPlaceBitmapMetadataWriter();
try {
writer.SetQuery("System.Title", title);
writer.SetQuery(@"/app1/ifd/{ushort=" + exiftagids[0] + "} ", (title + '\0').ToCharArray());
writer.SetQuery(@"/app13/irb/8bimiptc/iptc/object name", title);
return writer.TrySave();
}
catch {
return false;
}
的图像样本
您可以重现问题,通过下载图像样本,并使用此代码示例设置标题对这个(如果您有Windows 7)图片。
图像上有足够的空间元数据 - 这代码示例工作正常,在我的WinXP。
相同的代码工作正常Win7上与其他.jpg文件
You can reproduce problem (if you have Windows 7) by downloading image sample and using this code sample to set title on this image. Image has enough room for metadata - and this code sample works fine on my WinXP. Same code works fine on Win7 with other .JPG files.
任何想法,欢迎:)
推荐答案
我仍然没有找到答案,并有写exiftool包装而不是使用WPF的方式与元数据...
工作可能是som1会发现它很有用
I still didn't find the answer and has to write wrapper for exiftool instead of using WPF's way to work with metadata... May be som1 will find it useful.
这篇关于InPlaceBitmapMetadataWriter.TrySave()返回true,但什么都不做的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!