dragon66 / icafe

Java library for reading, writing, converting and manipulating images and metadata
Eclipse Public License 1.0
204 stars 58 forks source link

TIF - "DateTime (24, expecting 20)" #82

Closed ben-manes closed 6 years ago

ben-manes commented 6 years ago

We're encountering a problem that I think you can solve faster than we can. Specifically, there is a field in your TIFF files that does not meet the TIFF specification. We're getting the error "incorrect count for field "DateTime" (24, expecting 20)". This error is coming from libtiff by way of ImageMagick, and I think "count" in this case means field length. (Formatted date and time with seconds resolution and a terminator is 20 characters, maybe you're including milliseconds?)

I remember us fixing this a while back, but just got another report. I'll try to find a recent example to verify with.

ben-manes commented 6 years ago

This appears to be a regression of #65, as I see the timezone in a test sample with ImageMagick.

Properties:
  date:create: 2018-09-26T11:00:17-07:00
  date:modify: 2018-09-26T10:47:39-07:00
  signature: 0d6dd75bb57b24c4fe3196127362a27332e4ec0fb5e877875bba33286adf2652
  tiff:alpha: unspecified
  tiff:endian: msb
  tiff:photometric: RGB
  tiff:rows-per-strip: 1650
  tiff:software: ICAFE - https://github.com/dragon66/icafe
  tiff:subfiletype: PAGE
  tiff:timestamp: 2018:09:26 10:47:39 PDT
ben-manes commented 6 years ago

Looking for the format pattern, it seems you may have forgotten to update it in all places (remove z):

https://github.com/dragon66/icafe/blob/0e0805f1bbbd393263b8b517a2010775f34f5d1d/src/com/icafe4j/image/writer/TIFFWriter.java#L851-L852

dragon66 commented 6 years ago

@ben-manes You are actually right. I guess you are using the page by page write function and I missed the change for the writePage() function while fixing the previous bug you raised. Pushed in a new commit to fix this issue.

ben-manes commented 6 years ago

Thanks! Is there a CI or do you manually push out new snapshots?

dragon66 commented 6 years ago

Actually I haven’t pushed snapshot for a long time. I used to push it as part of the ant build process but have lost access to my personal computer.

ben-manes commented 6 years ago

hmm, well this is necessary for anyone using your library. I don't want to maintain my own builds.

It seemed to fail when trying to use jitpack, which might otherwise be an easy option. I think it's trying the maven build which results in an empty jar. Likely if you remove the pom it will fallback to ant, and that might work for me.

If you setup a free TravisCI build, you can have it push a snapshot to Sonatype on every commit. You can even do releases that way, if you tell it to do so when a git tag is created.

Do you any of these sound like something you could do?

dragon66 commented 6 years ago

Could be. Can you open a new issue for this so that we can close this one?

ben-manes commented 6 years ago

Will do, thanks!