jimp-dev / jimp-dev/jimp

I tried to add instagram filters from this code

Open
#1,015 1 comment 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
TypeScript
Stars
14.7k
Forks
777
PR merge metrics
No merged PRs in 30d

Description

Hi I tried these instagram filter from this source code

https://github.com/girliemac/filterous-2/blob/master/lib/instaFilters.js#L135

I think you need to add these two function

rgbAdjust: function rgbAdjust(rgbAdj,cb) {
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
var red = this.bitmap.data[idx];
var green = this.bitmap.data[idx + 1];
var blue = this.bitmap.data[idx + 2];
red *= rgbAdj[0]
green *= rgbAdj[1]
blue *= rgbAdj[2]
this.bitmap.data[idx] = red < 255 ? red : 255;
this.bitmap.data[idx + 1] = green < 255 ? green : 255;
this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;
});

if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}

return this;
},

and

colorFilter: function colorFilter(rgbColor,cb) {
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function (x, y, idx) {
var adj = rgbColor[3];
var red = this.bitmap.data[idx];
var green = this.bitmap.data[idx + 1];
var blue = this.bitmap.data[idx + 2];
red -= (red - rgbColor[0]) * adj;
green -= (green - rgbColor[1]) * adj;
blue -= (blue - rgbColor[2]) * adj;
this.bitmap.data[idx] = red < 255 ? red : 255;
this.bitmap.data[idx + 1] = green < 255 ? green : 255;
this.bitmap.data[idx + 2] = blue < 255 ? blue : 255;
});

if ((0, _utils.isNodePattern)(cb)) {
cb.call(this, null, this);
}

return this;
},

in plugin color, it's help shorten image manipulation.
and in sepia color filterous-2 has value to change sepia intensity

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.