Giter Club home page Giter Club logo

pif-image-format's Issues

Does "Color Table Size" specify the number of bytes, or entries?

I suspect it should be the number of bytes, since the "important" resources seem to prefer this semantics, but it's not 100% clear because some files quite explicitly suggest otherwise:

Number of bytes:

Number of entries:

  • Specification/PIF Format Specification.pdf

    Color Table Size: Index size of the color table, only used in Indexed mode, otherwise zero.

    To me, "index size" suggests the number of entries, not bytes. I understand "index size" as the size of the index set, i.e. "the maximum color table index that a pixel can refer to" plus 1 (because indices are from 0 to the number of color table entries minus one).

  • uint16_t colTableSize; // Color Table Size in Entries

    typedef struct {
          // ...
    	uint16_t colTableSize;		// Color Table Size in Entries
          // ...
    }pifINFO_t;

    I know that just because there's some field in pifINFO_t doesn't mean the actual file format uses the same semantics (for example see imageType, which has different values in pifINFO_t than the file format uses). But in this case, colTableSize is copied verbatim from the input .pif file without any conversion:

    p_PIF->pifInfo.colTableSize = _read16(p_PIF->pifFileHandler);

    And later in the code it's indeed treated as a number of entries (so it's not a lying code comment):

    if (colorCounter >= (p_PIF->pifInfo.colTableSize * ColorTablePixelSize))
    {
    // No more colors to read from the color table
    break;
    }

PIF Creation as a library

I'm working on a project where I want to have a server component (python) that ships images to a embedded LCD system (based around a ESP32).

Currently, I'm just using raw bitmaps, but this project looks like it'd be pretty handy. On the other hand, the current code for generating PIF images only seems to live in the converter GUI file.

This seems like the kind of thing that should be extracted out to a proper library, and be available somewhere like PyPi. Or at minimum in a separate file so it can be somewhat easily vendored.

I'd be happy to handle setting all that up, if you're OK with that, but I don't want to just jump in and start pushing stuff to PyPi without at least talking first.

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.