FreeImage - 将 zTXt 标签写入 PNG
这实在是让我很头疼。由于某种原因,我可以向 PNG 文件添加特定标签,但它没有按照我想要的方式添加,而且我不知道如何让它按照我想要的方式编写
给定代码;
Dim FImage As FIBITMAP = FreeImage.CreateFromBitmap(Image)
Dim FTag As New Metadata.MetadataTag(FREE_IMAGE_MDMODEL.FIMD_COMMENTS)
FTag.Key = "Description"
FTag.ID = 270
FTag.Value = Encoding.ASCII.GetBytes(DescString.ToString)
FTag.AddToImage(FImage)
FreeImage.Save(FREE_IMAGE_FORMAT.FIF_PNG, FImage, fbSaveTo.SelectedPath & "\TEST.dmi", FREE_IMAGE_SAVE_FLAGS.EXR_ZIP Or FREE_IMAGE_SAVE_FLAGS.PNG_Z_BEST_COMPRESSION)
假设 Image 是有效的,而 DescString 也是有效的(它是一个字符串生成器)。我正在尝试添加图像描述标签,我想将其专门编写为PNG文件中的zTXt
块,因为我需要具有该格式以便使该文件与另一个目标程序(Dream Maker)兼容。相反,它会写入一个 iTXt
标记,Dream Maker 不会读取该标记,这使得该文件毫无用处。
任何熟悉 FreeImage 的人都可以帮助我吗?或者有人可以推荐一个可以集成到我的程序中的替代方案吗?
This is really causing me a headache. For some reason or another, I can add a specific tag to a PNG file, but it's not adding the way I'd like and I don't know how to get it to write the way I want
Given the code;
Dim FImage As FIBITMAP = FreeImage.CreateFromBitmap(Image)
Dim FTag As New Metadata.MetadataTag(FREE_IMAGE_MDMODEL.FIMD_COMMENTS)
FTag.Key = "Description"
FTag.ID = 270
FTag.Value = Encoding.ASCII.GetBytes(DescString.ToString)
FTag.AddToImage(FImage)
FreeImage.Save(FREE_IMAGE_FORMAT.FIF_PNG, FImage, fbSaveTo.SelectedPath & "\TEST.dmi", FREE_IMAGE_SAVE_FLAGS.EXR_ZIP Or FREE_IMAGE_SAVE_FLAGS.PNG_Z_BEST_COMPRESSION)
Assume that Image is valid and that DescString is too (it's a stringbuilder). I'm trying to add the Image Description tag, which I want to have written specifically as a zTXt
chunk in the PNG file, as I need to have that format in order for the file to be compatible with another target program (Dream Maker). Instead, it writes an iTXt
tag, which Dream Maker doesn't read which makes the file useless.
Can anyone familiar with FreeImage help me out, or could anyone recommend an alternative that I can integrate into my program?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论