JVips icon indicating copy to clipboard operation
JVips copied to clipboard

Add more complex pixel transformations

Open TimoZikeli opened this issue 4 years ago • 1 comments

Hi, It would be great to have the possibility for more complex pixel transformations than linear. For example, for every pixel, it would be nice if it was possible to specify some 3(/4) functions r(r, g, b, [a]), g(r, g, b, [a]), b(r, g, b, [a]), a(r, g, b, a) using linear transformation of these parameters. This would enable applying nice effects like Sepia.

Specifically. JVips could take 4 parameters for newR, newG, newB and optionally newA, each of the form

[r, g, b, a, d]

meaning:

newR = max(0, min(255, oldR*r + oldG*g + oldB*b + oldA*a + d))

(respectively for newG, newB, newA).

Thanks!

TimoZikeli avatar Oct 29 '20 13:10 TimoZikeli

Hello, I see, we have to check first how we can do that with libvips in C

dbouron avatar Nov 01 '20 11:11 dbouron