←选择平台

RasterCommentMetadata类

总结
扩展了RasterMetadata类提供的功能来处理元数据存储在各种图像文件格式发表评论。
语法
c#
VB
objective - c
c++
Java
[SerializableAttribute ()]公共RasterCommentMetadata:RasterMetadata
< SerializableAttribute () >公共RasterCommentMetadata继承了RasterMetadata
@接口LTRasterCommentMetadata: LTRasterMetadata
公共RasterCommentMetadata扩展RasterMetadata实现了可序列化的
[SerializableAttribute ()]公共ref类RasterCommentMetadata:公共RasterMetadata
讲话

TIFF文件格式支持的评论数保存和加载使用预定义的标记。

如果意见不符合您的需要,您可以定义您自己的标记为节省额外non-raster TIFF文件中的数据。例如,您可能需要定义一个标签保存注释。

TIFF 6.0规范预留,开发人员可以定义一系列私人标签。为了避免与其他开发人员创建的文件相冲突,你可以注册你的标签通过联系Adobe开发人员关系。电子邮件地址发布在非官方TIFF主页gapdevsup@adobe.com

一些限制适用于这个函数如果你使用一个IFD页面写元数据表示。看到加载和保存大TIFF文件主题的更多信息。

例子

这个例子写评论气管无名动脉瘘管的不同数据类型的现有文件然后读取测试。

c#
VB
使用Leadtools;使用Leadtools.Codecs;公共无效RasterCommentMetadataExample (){RasterCodecs编解码器=RasterCodecs ();编解码器。ThrowExceptionsOnInvalidImages =真正的;字符串srcFileName = Path.Combine (LEAD_VARS.ImagesDir,“Image1.cmp”);字符串destFileName = Path.Combine (LEAD_VARS.ImagesDir,“Image1_comments.tif”);/ /加载图像RasterImage图像= codecs.Load (srcFileName);编解码器。保存(图像、destFileName RasterImageFormat。Tif, 24);image.Dispose ();/ /写一些评论气管无名动脉瘘管的现有文件RasterCommentMetadata评论=RasterCommentMetadata ();发表评论。类型= RasterCommentMetadataType.Artist;字符串artistNameWrite =“艺术家名称”;comment.FromAscii (artistNameWrite);Console.WriteLine (“写艺术家”);编解码器。WriteComment (destFileName 1评论);发表评论。类型= RasterCommentMetadataType.GpsLatitude;RasterMetadataRational [] rationalsWrite =RasterMetadataRational [3];(int我= 0;我< rationalsWrite.Length;我+ +)rationalsWrite[我]=RasterMetadataRational(我+ 3,+ 2);comment.FromRational (rationalsWrite);Console.WriteLine (“写作GpsLatitude”);编解码器。WriteComment (destFileName 1评论);/ /现在评论从tif文件读/ /读ASCII评论=编解码器。ReadComment (destFileName 1 RasterCommentMetadataType.Artist);字符串artistNameRead = comment.ToAscii ();Console.WriteLine (“艺术家:{0}”,artistNameRead);断言。IsTrue (artistNameRead = = artistNameWrite);/ /读理性评论=编解码器。ReadComment (destFileName 1 RasterCommentMetadataType.GpsLatitude);RasterMetadataRational [] rationalsRead = comment.ToRational ();int大小= rationalsRead.Length;Console.WriteLine (“GpsLatitude:大小= {0}”、大小);(int我= 0;我<大小;我+ +)Console.WriteLine (“{0}/ {1}”,rationalsRead[我]。分子,rationalsRead[我].Denominator);Assert.IsTrue (rationalsRead。长度= = rationalsWrite.Length);(int我= 0;我< rationalsRead.Length;我+ +){Assert.IsTrue (rationalsRead[我]。分子= = rationalsWrite[我].Numerator);Assert.IsTrue (rationalsRead[我]。分母= = rationalsWrite[我].Denominator);}}静态LEAD_VARS{公共常量字符串ImagesDir =@“C: \ LEADTOOLS21 \ Resources \图片”;}
进口Leadtools进口Leadtools.Codecs公共RasterCommentMetadataExample ()昏暗的编解码器作为RasterCodecs =RasterCodecs ()编解码器。ThrowExceptionsOnInvalidImages =真正的昏暗的srcFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Image1.cmp”)昏暗的destFileName作为字符串= Path.Combine (LEAD_VARS.ImagesDir“Image1_comments.tif”)“加载图片昏暗的图像作为RasterImage = codecs.Load (srcFileName)编解码器。保存(图像、destFileName RasterImageFormat。Tif, 24)image.Dispose ()气管无名动脉瘘管的现有文件的写一些评论昏暗的评论作为RasterCommentMetadata =RasterCommentMetadata ()发表评论。类型= RasterCommentMetadataType.Artist昏暗的artistNameWrite作为字符串=“艺术家名称”comment.FromAscii (artistNameWrite)Console.WriteLine (“写艺术家”)编解码器。WriteComment (destFileName 1评论)发表评论。类型= RasterCommentMetadataType.GpsLatitude昏暗的rationalsWrite作为RasterMetadataRational () =RasterMetadataRational (2) {}昏暗的作为整数= 0我< rationalsWrite.LengthrationalsWrite (i) =RasterMetadataRational(我+ 3,+ 2)我+ = 1循环comment.FromRational (rationalsWrite)Console.WriteLine (“写作GpsLatitude”)编解码器。WriteComment (destFileName 1评论)“现在阅读评论从tif文件“读ASCII评论=编解码器。ReadComment (destFileName 1 RasterCommentMetadataType.Artist)昏暗的artistNameRead作为字符串= comment.ToAscii ()Console.WriteLine (“艺术家:{0}”artistNameRead)调试。作为sert(artistNameRead = artistNameWrite)“读理性评论=编解码器。ReadComment (destFileName 1 RasterCommentMetadataType.GpsLatitude)昏暗的rationalsRead作为RasterMetadataRational () = comment.ToRational ()昏暗的大小作为整数= rationalsRead.LengthConsole.WriteLine (“GpsLatitude:大小= {0}”、大小)我= 0我<大小Console.WriteLine (“{0}/ {1}”rationalsRead (i)。分子,rationalsRead(我).Denominator)我+ = 1循环Debug.Assert (rationalsRead。长度= rationalsWrite.Length)我= 0我< rationalsRead.LengthDebug.Assert (rationalsRead(我)。分子= rationalsWrite(我).Numerator)Debug.Assert (rationalsRead(我)。分母= rationalsWrite(我).Denominator)我+ = 1循环结束公共NotInheritableLEAD_VARS公共常量ImagesDir作为字符串=“C: \ LEADTOOLS21 \ Resources \图片”结束
需求

目标平台

Leadtools组装
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2021领先的技术公司。保留所有权利。