开发者

FreeImage - Write zTXt tag to PNG

开发者 https://www.devze.com 2023-01-09 01:14 出处:网络
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

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消