Code Monkey home page Code Monkey logo

Comments (3)

lvandeve avatar lvandeve commented on July 21, 2024

It is not directly supported.

However, there are some helper functions that allow using it. It could be done as follows:

  1. decode the image as normal and have the result in one big image
  2. back from the beginning of the file, use "lodepng_chunk_next_const" and "lodepng_chunk_type_equals" to navigate to the sTER chunk (or stop once IDAT, IEND or end of file is reached, then there is none)
  3. read the one byte called "mode" from the chunk
  4. allocate two new image buffers, and write a 2D for loop through the big image with y from 0 to height, x from 0 to width, and follow the spec in point 3.6 at http://www.libpng.org/pub/png/spec/register/pngext-1.4.0-pdg.html to output pixels in one or the other output image buffer
  5. if needed to get the pHYs information for the pixel ratio, use in step 1. a decoding function that outputs information to a LodePNGState, then it will have phys_x, phys_y and phys_unit in the LodePNGInfo.

I hope this helps

from lodepng.

MarcusJohnson91 avatar MarcusJohnson91 commented on July 21, 2024

If I wanted to add support for the sTER chunk, how would I go about doing that?

I could probably get it done within a day, but I only know C, not C++. so classes are magic to me.

from lodepng.

lvandeve avatar lvandeve commented on July 21, 2024

I would prefer to not have it in LodePNG, I would like to keep the library focused on one thing, the pure PNG spec.

But it could be implemented as a utility function in lodepng_util.cpp. Thanks to the lodepng_chunk_... functions, and preprocessing/postprocessing of the image, it doesn't need to be inside the core library.

from lodepng.

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.