Skip to content

faultier/lory

Repository files navigation

Lory

Build Status

This project provides C library and tool that convert image to a selective color image.

original image:

original

selective color red:

red

selective color green:

green

selective color blue:

blue

Instration

If you want command line tool and shared library:

mkdir build
cd build
cmake ..
make
sudo make install

Or you want static library for Android:

mkdir android-build
cd android-build
cmake -DLORY_ANDROID=ON -DCMAKE_INSTALL_PREFIX=/path/to/android-project ..
make install

Usage

with jpeglib

struct jpeg_decompress_struct in;
struct jpeg_compress_struct out;

// ...

if (in.out_color_space == JCS_RGB && in.output_components == 3) {
    JSAMPROW buffer = (JSAMPROW)calloc(sizeof(JSAMPLE), in.output_width * in.output_components);
    while (in.output_scanline < in.output_height)
    {
        jpeg_read_scanlines(&in, &buffer, 1);
        lory_convert_rgb_array(buffer, in.output_width, hue, range);
        jpeg_write_scanlines(&out, &buffer, 1);
    }
    free(buffer);
}

with Android bridge

import jp.faultier.android.lory;
import android.graphics.Bitmap;

// Bitmap shuould be mutable and ARGB_8888
Lory.convertBitmap(bitmap, hue, range);

// or use preset
Lory.convertBitmap(bitmap, Lory.Preset.RED);

loryconv

loryconv -h 0.0 -r 60.0 -o lory-red.jpg lory.jpg

Todo

  • iOS support
  • Algorithm enhancement
  • Performance tuning

License

This project distributed under the MIT License. http://opensource.org/licenses/MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published