Code Monkey home page Code Monkey logo

Comments (14)

photopea avatar photopea commented on May 23, 2024

Could you show me a PNG file with such chunks? Are they frequent? Is there useful data in these chunks?

from upng.js.

adam-snyder avatar adam-snyder commented on May 23, 2024

These chunks are similar to tEXt but take advantage of compression. They would only be present for specific use cases. In our case, we were embedding per-pixel data as text content (JSON) and, because of the size of these PNGs, we needed to compress the chunks for performance. I can't really provide an example, but it is part of the spec: https://www.w3.org/TR/PNG-Chunks.html

from upng.js.

photopea avatar photopea commented on May 23, 2024

I know what zTXt is and how it works. But I have never seen a PNG with such data. I don't like making my library 500 Bytes larger becaus of something, what is never used in a real world.

If you need to decode a PNG with zTXt chunk, could you share it with me? I am used to test an implementation, even if it is simple and seems to be correct.

from upng.js.

hbs avatar hbs commented on May 23, 2024

I concur to the usefulness of supporting compressed text chunks, not only zTXt chunks but also iTXt chunks with compressionFlag set to true.

from upng.js.

photopea avatar photopea commented on May 23, 2024

As I said, I have never seen a PNG with a zTXt and iTXt chung. So I think nobody uses it. Do you have such PNGs?

from upng.js.

hbs avatar hbs commented on May 23, 2024

Many libraries allow to set the compressionFlag to true when generating iTXt chunks, so such PNGs can easily be generated. If you do not want to add decompression you should at least consider adding a flag in the case of iTXt so the user can decide to deflate compressed content. Or maybe use an ArrayBuffer as the value instead of a string.

from upng.js.

photopea avatar photopea commented on May 23, 2024

Do you need to create PNGs with these chunks with UPNG.js , or to parse them?

I would be happy to implement it, but could you share such PNG with me? I do not use native apps other than a browser and a notepad (I develop in Javascript).

from upng.js.

hbs avatar hbs commented on May 23, 2024

Hi, my need is to be able to read compressed iTXt chunks using UPNG.js. Here is a data URL for a 1x1 PNG with an iTXt chunk with keyword 'UPNG.js' and a zlib compressed text associated with it:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAUmlUWHRVUE5HLmpzAAEAAAB4nAvJyCxWAKLi/NxUheT83IKi1OLi1BSFktSKEoXE4uL85MzEEiC/PLMkQ6EkI1UhNMDPXS+rWCE7tbI8vyhFDwAcphfYZIu9eAAAAAtJREFUeNpjYAACAAAFAAHp+tzYAAAAAElFTkSuQmCC

from upng.js.

photopea avatar photopea commented on May 23, 2024

It is implemented now :)

from upng.js.

hbs avatar hbs commented on May 23, 2024

Awesome!

from upng.js.

photopea avatar photopea commented on May 23, 2024

thanks for sharing a PNG with us.

Although, I still doubt anybody will use this chunk. It is more convenient to store metadata in exif or xmp chunks.

from upng.js.

hbs avatar hbs commented on May 23, 2024

Supporting zTXt chunks should be as easy then, they are basically tEXt chunks except the text is deflated see https://www.w3.org/TR/PNG-Chunks.html

from upng.js.

hbs avatar hbs commented on May 23, 2024

XMP data is stored in iTXt chunks when taking a snapshot on MacOS, depending on data length maybe it may be compressed.

from upng.js.

photopea avatar photopea commented on May 23, 2024

I would like to make UPNG.js for files, which are made in practice. There exist e.g. a lossless JPG format, which was defined together with a lossy JPG, but is not supported by any decoder, as nobody ever used it. Are you sure zTXt are used in practice?

from upng.js.

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.