Необходимо воссоздать фотошопный эффект soft light на php без использования ничего кроме gdlib.
На входе 2 картинки, скажем 1000 на 1000 пикселей обе. Одна из них с альфа прозрачностью. Допустим, они просто лежат в папке. При запуске скрипта та что прозрачная накладывается на нижнюю с эффектом soft light и получается на выходе третья картинка, jpg c качеством 80%. И складывается в папку же.
Например,
картинка 1
наложение картинки 2 на 1 без эффекта
наложение с эффектом софт лайт
Здесь описан какой-то возможный вариант, как по пикселям идти и менять цвета.
Тут вроде описана математика именно этого эффекта, которая при этом происходит
Soft Light
Darkens or lightens the colors, depending on the blend color. The effect is similar to shining a diffused spotlight on the image. If the blend color (light source) is lighter than 50% gray, the image is lightened as if it were dodged. If the blend color is darker than 50% gray, the image is darkened as if it were burned in. Painting with pure black or white produces a distinctly darker or lighter area, but does not result in pure black or white.
Photoshop Soft Light Blending Mode
Math
r = (1 top) * top * bottom + top * (1 (1 top) * (1 bottom))
Code
This one is more complicated that most, so I normalized the layers first and then put them into the return statement.
public static int channelSoftLight( int top, int bottom ) {
double a = normalize( top );
double b = normalize( bottom );
return (int) ( Math.round( 255 * ( ( 1 a ) * a * b + a * ( 1 ( 1 a ) * ( 1 b ) ) ) ) );
}
Важно сделать максимально быстрым алгоритм, чтоб не обваливал сервер.
Просьба сразу называть свою цену.