.net - LibTiff.net Not able to update EXIF_USERCOMMENT field -


I just want to update the tif image on the EXIF_USERCOMMENT field I am making

The call to SetField fails. Not sure what I'm doing wrong

Here's my very simple code.

Any help would be appreciated.

  {TIFF tiffdoc = Tiff.Open ("C: \ temp \\ ~ tempCapture.tif", "RW"); Bool bSetField = tiffdoc.SetField (TiffTag.EXIF_USERCOMMENT, "Test Comment Field"); Tiffdoc.WriteDirectory (); Tiffdoc.close (); }    

Unfortunately, it seems that LibTiff.Net only read EXIF ​​tags Can not write them and write them (original libtiff can not write EXIF ​​tag either)

That's why it's why. Here are some quotes from the discussion:

  // FIXME - We currently do not support writing EXIF ​​fields. In TIFF // theory this allows the use of the custom IFD directory, but at present, it seems that libtiff only supports readings / IFD readings, not written to them. Leonard Rossenthal:  
  I really do not think Liberif really wants to start metadata "Rabbit Hole" ...   

Bob Frisenhaughn:

  I agree with Leonard Rosenthal that Libertif should not be in business with the handling of the XF private IFD tag (even if it is already already )   

For unknown tags EXIF_USERCOMMENT , you must add the library EXIF ​​tag to the list of known tags before reading the EXIF ​​directory and later unknown The tag will not issue an error.

But the library will still not be able to write the EXIF ​​tag to file.

Edit:

You have some options if you only want to store some information in your file and do this by EXIF_USERCOMMENT There is no need to store in the tag.

You can use the IMAGEDESCRIPTION tag for your work below is the sample code that uses this tag. Please note that the code uses different parametr for the open method and also uses RewriteDirectory instead of WriteDirectory .

  string filename = "c: \\ temp \\ ~ tempCapture.tif"; Use (TIFF Tiffdock = TIFF Open (Filename, "A")) {tiffdoc.SetDirectory (0); bool bSetField = tiffdoc.SetField (TiffTag.IMAGEDESCRIPTION, "Test Comment Field"); Tiffdoc.RewriteDirectory (); }    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -