views:

29

answers:

0

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?