Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Samachi opened this issue Sep 6, 2024 · 0 comments
Open

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

Samachi opened this issue Sep 6, 2024 · 0 comments

Comments

@Samachi
Copy link

Samachi commented Sep 6, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants