Code Monkey home page Code Monkey logo

Comments (6)

targos avatar targos commented on July 23, 2024

Do you have an example of file with such textual information so we can understand:

  • Which chunk is most appropriate for it
  • How the API should look like to pass it to the encoder

from fast-png.

lpatiny avatar lpatiny commented on July 23, 2024

I guess one idea is that when you copy a molecule as PNG we can insert the smiles or molfile in it so that if we somehow copy it back from another software we cane extract the chemical structure.

Using imagemagick we can add a new keyword in a PNG using:

convert butane.png -set 'Smiles' 'CCCC' butane_meta.png

We can check if the keyword has been added using identify --verbose butane_meta.png

You will find here both images before and after adding the Smiles

Archive.zip

There are 3 possible chunks:

  • tEXt for ASCII < 128
  • iTXt for UTF-8
  • zTXt for zlib compressed data

from fast-png.

stropitek avatar stropitek commented on July 23, 2024

FWIW excalidraw exports a png with a json in the metadata so that it can be re-edited:

CleanShot 2024-02-13 at 10 24 31

This is the png with the embedded data:
excalidraw_export_embed

from fast-png.

targos avatar targos commented on July 23, 2024

Both your examples use the tEXt chunk, so we only need to implement the encoder part of it.

BTW, thanks @stropitek for your example, it made me realize that the decoding was wrong. Fixed in #39

from fast-png.

targos avatar targos commented on July 23, 2024

@lpatiny is latin1 enough for your use case?

from fast-png.

lpatiny avatar lpatiny commented on July 23, 2024

Yes latin1 is enough for SMILES and molfile.

from fast-png.

Related Issues (14)

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.