This project provides C library and tool that convert image to a selective color image.
original image:
selective color red:
selective color green:
selective color blue:
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
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);
}
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 -h 0.0 -r 60.0 -o lory-red.jpg lory.jpg
- iOS support
- Algorithm enhancement
- Performance tuning
This project distributed under the MIT License. http://opensource.org/licenses/MIT