Git Product home page Git Product logo

Comments (4)

Ono-Sendai avatar Ono-Sendai commented on May 3, 2024

There are more incorrect readings but i'll leave it at that for now.

from wuffs.

nigeltao avatar nigeltao commented on May 3, 2024

basn0g16.png (16 bit (64k level) grayscale):
bits_per_pixel is incorrectly reported as 8. (should be 16)

Yeah, that's a known bug / TODO.

basn2c16.png (3x16 bits rgb color):
bpp incorrectly reported as 64, should be 48.
channel_3_bits incorrectly reported as 16, should be 0.

Or am I misunderstanding wuffs, and it's doing some automatic conversion in some weird way?

It's sort of doing automatic conversion. Wuffs' pixel swizzler supports converting from pixel format S to pixel format D for a variety of S and D pixel formats, but it's not the full set of all possible pairs of pixel formats. The pixel format set by decode_image_config is conventionally one of the supported S pixel formats. Whilst the PNG file format has 3x16 RGB separate from 4x16 RGBA, the former seems rare enough in practice that it wasn't worth dedicated code paths converting from 3x16 RGB to all of the supported D pixel formats. Instead, for Wuffs' PNG decoder, 3x16 RGB is 'rounded up' to a superset S format: 4x16 RGBA (and the Alpha values are always 0xFFFF).

There are more incorrect readings but i'll leave it at that for now.

I'm curious what the others are, although I suspect they're expanded for the same reason. For example, YA (Gray + Alpha) is expanded to RGBA (with R = G = B = Y).

from wuffs.

Ono-Sendai avatar Ono-Sendai commented on May 3, 2024

Yeah, basn4a08.png, which is 8 bit grayscale + 8 bit alpha-channel, is reported as 32bpp with 4 channels.

from wuffs.

nigeltao avatar nigeltao commented on May 3, 2024

Closing as Working As Intended.

from wuffs.

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.