Giter Club home page Giter Club logo

Comments (4)

Bobrovsky avatar Bobrovsky commented on May 29, 2024

According to the documentation, WriteEncodedStrip returns

The number of encoded and written bytes or -1 if an error occurred.

So, if the function returns 0, you can be sure it didn't write any data. In my opinion, this covers the use case you described.

from libtiff.net.

makingbloke avatar makingbloke commented on May 29, 2024

from libtiff.net.

Bobrovsky avatar Bobrovsky commented on May 29, 2024

In your first message you were talking about Tiff class from the library. Now you are talking about Copier class from TiffCp utility.

If you think there is an issue in code, then please try to be more specific about where it resides. And please feel free to send us pull requests with fixes.

from libtiff.net.

makingbloke avatar makingbloke commented on May 29, 2024

Apologies, hopefully this clarification will make more sense.

I can reproduce this issue using tiffcp.exe. I have a sample TIFF with 11 pages (unfortunately I cannot share it as it contains client data). Page 3 is JPEG encoded and the other pages use Group4. When TiffCp tries to copy page 3 it reports an error "JPEGLib: Not implemented yet". This then writes out a page with an incomplete directory entry and no image data. My point is, if the code reaches an error like this then I think it should abort the copy rather than write a malformed directory entry to the output tiff.

I debugged the issue and traced through the source code and found it was happening because when the error occurred in WriteEncodedStrip in Tiff.cs (line 5303) instead of returning -1 which would indicate an error it's returning 0 so the calling function thinks nothing has been read and carries on.

As I said I cannot attach the original Tiff but I've attached a zip file containing a dump of the tags from the source Tiff (sample.txt - it's a quite old one created by Imaging for Windows) and also the corrupt Tiff created by TiffCp (sample.tif). As you can see it's creating a header with no StripOffsets or RowsPerStrip.

I hope this makes more sense, thanks for your time and your patience.

Cheers
sample.zip

from libtiff.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.