cla*

download , github , demo

*color-level-adjuster

cla is a small javascript image processing library for applying an automatic color level adjustment to an image at the client side . cla may improve the tonal quality of the image ( especially photos with low color range )

Library contains a single function named adjustColorLevel in a single javascript file . Library is also available as a typescript file .

adjustColorLevel function takes 2 parameters

sample usage

var rawImage = new Image();
rawImage.src = 'sample.jpg';

// you can also select your <img> tag and assign to rawImage , example :
// rawImage = document.getElementById('your-image-id');

adjustColorLevel(rawImage , imageProcessHandler);

function imageProcessHandler(processedImage , modificationRate)
{
    document.body.appendChild(rawImage);
    document.body.appendChild(processedImage);
}

modificationRate is a number ranging between 0-100 which shows the amount of modification that the image processing has done . Having the modificationRate equals to 0 means that , raw image already has a high color range and processing did not change anything .

Image source of the processedImage is encoded as base64 string .

Examples

image