GithubHelp home page GithubHelp logo

catid / z16 Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 1.0 42.18 MB

16-bit monochrome image compressor based on Zstd

License: BSD 3-Clause "New" or "Revised" License

CMake 0.07% C++ 16.24% C 83.08% Starlark 0.15% Makefile 0.44% Batchfile 0.03%

z16's Introduction

Z16: 16-bit Monochrome Image Compressor

Roughly 2x faster to encode/decode than PNG, while providing smaller file sizes.

Quick Guide

Build and run the tool from source.

Compressing test.png to test.z16:

$ ./z16_tool.exe -i test.png -o test.z16 -v -f
Image read in 474.741 msec: test.png
Image encoded in 779.719 msec: test.z16
Image written to file in 31.449 msec: test.z16

$ ./z16_tool.exe -i test.z16 -o test2.png -v -f
Decode in 256.454 msec: test.z16
Write PNG output in 1784.75 msec: test2.png

The resulting file is 10% smaller than the original PNG, while [de]compressing faster.

SDK Guide

Link to the z16 library. Add to your source code: #include <z16.h> Take a look at the app/z16_tool.cpp software to see how to use the simple API.

Simplified example:

    z16_Codec codec = z16_Create();
    if (!codec) {
        // error handling
    }
    ScopedFunction codec_scope([&]() {
        z16_Destroy(&codec);
    });

    z16_Frame frame;
    frame.Format = z16_Format_Mono16;
    frame.HeightPixels = height;
    frame.Image = data;
    frame.StrideBytes = stride;
    frame.WidthPixels = width;

    int32_t bytes = 0, error;
    uint8_t* data = z16_Encode(codec, &frame, &bytes, &error);
    if (!data) {
        // error handling
    }

    z16_Frame* decoded = z16_Decode(codec, data, bytes, &error);
    if (!decoded) {
        // error handling
    }
    ScopedFunction frame_scope([&]() {
        z16_Free(codec, &decoded);
    });

z16's People

Contributors

catid avatar goel42 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

goel42

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.