Page 1 of 1

Replicating Photoshop's filters and adjustments in code

Posted: 2017-01-11T14:54:54-07:00
by Stefan Monov
Ok, I realize this is a really broad topic, but I thought: why not? This is not StackOverflow where broad topics or topics asking for links are closed.

Do you know of a resource with descriptions of how to implement the various Photoshop filters and adjustments? Or just plain has implementations of them?

E.g. Chrome filter; Black and White adjustment.

I'm not asking for the blend modes because descriptions and implementations of those are easily found on the web.

There's pieces of info here and there, e.g. see:
But it's too little, too scattered and often wrong.

Even if it's not a single resource, I'd appreciate links to sites that explain that stuff for even just one or several Photoshop filters/adjs.

And just to bring something to the table myself:

The PS "Photo filter" adjustment is implemented like this (pseudocode):

Code: Select all

Image photoFilter(Image src, RGB tint, bool preserveLuminance) {
	Image muld = blend(BLEND_MULTIPLY, src, tint);
	if(preserveLuminance) {
		return blend(BLEND_LUMINANCE, muld, src);
	} else {
		return muld;
	}
}
... where, of course, blend(BLEND_LUMINANCE...) is implemented with the HCL colorspace as implemented in ImageMagick.

Re: Replicating Photoshop's filters and adjustments in code

Posted: 2017-01-11T15:59:30-07:00
by fmw42
I have tried to reverse engineer a few as unix shell scripts with Imagemagick. You can find my scripts at my link below. But I know of no comprehensive resource, since photoshop is a closed tool and I know of no explanations of the details of their code. A google search sometimes will come up with tutorials on how to do some specific filter. That is the resource from which I started some of my attempts. With other filters, I just played around with the PS controllers and some understanding of what might be going on to make an attempt to reproduce similar results.

Re: Replicating Photoshop's filters and adjustments in code

Posted: 2017-10-13T07:29:54-07:00
by ivanhoe90
Hi, I am making a program www.Photopea.com, which should have the full support for PSD files. And since PSD files can have Adjustment layers and Smart Filters, I have to implement PS adjustments and filters, too.

I have been implementing PS adjustments and filters for several years now. You can see what I already have at Photopea.com .