Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some color types aren't correct #1

Open
Tyriar opened this issue Jan 22, 2022 · 5 comments
Open

Some color types aren't correct #1

Tyriar opened this issue Jan 22, 2022 · 5 comments

Comments

@Tyriar
Copy link

Tyriar commented Jan 22, 2022

Just trying this out, you might not be aware that some of the file names aren't actually correct. I'm guessing the method used to encode with lodepng made some optimizations or something? Decoding rand_9_7_8_3_0_1_0.png for example which is meant to use indexed color type (3), it's actually truecolor and alpha (6). I've also notice bit depth isn't necessarily kept the same.

It's probably worth clarifying this in the readme if it's by design so people don't bother trying to test properties that could be optimized away. My tool (Luna Paint) has an upcoming feature to inspect the files which is why it would be beneficial to test props like this, but it doesn't matter so much as I already have plenty of coverage from other suites.

See details output by my tool below which calls out the color type and lack of PLTE/tRNS chunks.

rand_9_7_8_3_0_1_0.png

Details

  • Width: 9
  • Height: 7
  • Bit depth: 8
  • Color type: Truecolor and alpha (6)
  • Interlace method: None

Metadata

No recognized metadata

Raw chunks

[
  {
    "offset": 8,
    "type": "IHDR",
    "dataLength": 13,
    "isAncillary": false,
    "isPrivate": false,
    "isSafeToCopy": false
  },
  {
    "offset": 33,
    "type": "IDAT",
    "dataLength": 317,
    "isAncillary": false,
    "isPrivate": false,
    "isSafeToCopy": false
  },
  {
    "offset": 362,
    "type": "IEND",
    "dataLength": 0,
    "isAncillary": false,
    "isPrivate": false,
    "isSafeToCopy": false
  }
]
@richgel999
Copy link
Owner

richgel999 commented Jan 23, 2022

Yes - lodepng has numerous optimizations that can change colortypes/etc. Sorry about that. I updated the README. I want to fix this, but I'll have to see if lodepng supports disabling all its optimizations. (Or find or write another writer.)

It's really clear that we do need a robust list of random PNG's for testing/fuzzing. I couldn't find any on the net so I uploaded this repo.

@richgel999
Copy link
Owner

Found this in lodepng:

unsigned auto_convert; /automatically choose output PNG color type. Default: true/

I'm working on improving this. Thanks again for pointing this out!

@richgel999
Copy link
Owner

I've pushed up a new set of images, this time as a .7z file which is more manageable. What I plan on doing is putting up the little C++ program that uses lodepng to generate them. It's difficult to figuring out exactly how to feed lodepng's encoder in just the right way to generate this data.

@Tyriar
Copy link
Author

Tyriar commented Jan 23, 2022

Sounds good, thanks 🙂

@Tyriar
Copy link
Author

Tyriar commented Jan 23, 2022

FWIW I mostly use windows so 7z is a bit of a pain (would need to install 7zip on all my Windows machines and include node bindings to it), using zip or putting the images in a folder would be easier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants