Git Product home page Git Product logo

exoquant's Introduction

ExoQuant v0.7

ExoQuant is a high-quality, easy to use color quantization library. This is for you if you need one or more of the following:

  • Very high-quality color reduction
  • Reduction of images including alpha
  • Creation of a shared palette for more than one image (or mipmap level)
  • Dithering of the reduced image with very little noise

Usage:

First, of course, you need to include exoquant.h:

#include "exoquant.h"

Then for each image or texture to convert follow the following steps:

Step 1: Initialise and set options.

First you need to init the library by calling exq_init:

exq_data *pExq;
pExq = exq_init();

Then you can set the following options:

Option: Alpha is no transparency

Use this option if you don't use the alpha channel of your image/texture as transparency or if the color is already premultiplied by the alpha. To set this option just call exq_no_transparency:

exq_no_transparency(pExq);

Step 2: Feed the image data

Now you need to feed the image data to the quantizer. The image data needs to be 32 bits per pixel. The first byte of each pixel needs to be the red channel, the last byte needs to be alpha.

To feed the image data you have to call exq_feed, which can be called more than once to create a shared palette for more than one image, for example for a texture with several mipmap levels:

exq_feed(pExq, pImage_data, num_pixels);

Step 3: Color reduction

exq_quantize(pExq, num_colors);
exq_quantize_hq(pExq, num_colors);
exq_quantize_ex(pExq, num_colors, high_quality);

Step 4: Retrieve the palette

exq_get_palette(pExq, pPalette, num_colors);

Step 5: Map the image to the palette

exq_map_image(pExq, num_pixels, pIn, pOut);
exq_map_image_ordered(pExq, width, height, pIn, pOut);

Step 6: Clean up

Call exq_free to free the quantization data:

exq_free(pExq);

Licence

ExoQuant v0.7

Copyright (c) 2004 Dennis Ranke

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

exoquant's People

Contributors

dennisranke avatar exoticorn avatar lovell avatar thealphadollar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

exoquant's Issues

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.