Code Monkey home page Code Monkey logo

Comments (3)

rouault avatar rouault commented on August 16, 2024

@slesim Can you attach such a file ? I believe the root cause is that TIFF color table entries are expressed as values in the [0,65535] range, and not [0,255], so software has to do remapping. GDAL uses division by 257 and truncation to do the conversion from [0,65535] to [0,255]. Other software might have slightly different approaches. The TIFF specification doesn't specify how to do that remapping

Current behaviour dates back to this changeset eeec5b6 that went in GDAL 2.3.0. Previously division by 256 was done.

from gdal.

cgohlke avatar cgohlke commented on August 16, 2024

Tifffile does not do any conversion or remapping. tif.pages[0].tags['ColorMap'].value is a numpy array of dtype uint16.

The conversion in the example code is int.from_bytes(r[i]), which is wrong in general but happens to give expected results for multiples of 256.

from gdal.

slesim avatar slesim commented on August 16, 2024

Thanks for your answers, it helps my understanding.
Here is a sample file :
rugoIndex.zip

from gdal.

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.