Skip to content

SetField doesn't seem to work when write TiffTag.XMLPACKET #107

Open
@Samachi

Description

@Samachi

It works well for reading XMLPACKET, but it doesn't work for writing XMLPACKET using SetField.
I figured it out for myself and wrote it in a way that seemed easier:

output.SetField(TiffTag.IMAGEWIDTH, tiff.GetField(TiffTag.XMLPACKET));

But an exception is thrown:
System.InvalidCastException:“Unable to cast object of type 'BitMiracle.LibTiff.Classic.FieldValue[]' to type 'System.IConvertible'.”

Let me write it a different way:

output.SetField(TiffTag.XMLPACKET, new object[] { tiff.GetField(TiffTag.XMLPACKET)[0].Value, tiff.GetField(TiffTag.XMLPACKET)[1].Value});

This time it could run, but it didn't seem to work.

When I checked the source code, the SetField method doesn't seem to have an implementation for XMLPACKET.

Would you tell me how to write XMLPACKET data? Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions