Surface Blur and Median
blog.photopea.com
blog.photopea.com
- GIMP & Photoshop use the same O(n²) algorithm
- GIMP's implementation is single threaded, while photoshop's is multithreaded and therefore performs much faster on modern multi-core CPUs
- Photopea uses a different algorithm with O(n) characteristics
- O(n) in a single threaded javascript is faster than O(n²) in parallel C/C++ for large values of n
- For photo editing, we used to work with relatively small photos, so algorithm choice didn't matter so much. But with modern digital cameras algorithm choice matters as we are seeing photo filters now working with larger values of n (pixel radius in this case).
Therefore, choosing the right algorithm matters.
- GIMP uses Θ(n * r²) algorithm
- Photoshop uses Θ(n * r) algorithm
- r<=10: Photopea uses Θ(n * r) algorithm
- r> 10: Photopea uses Θ(n) algorithm with a large linear coefficient
For r<=10 Photopea and Photoshop use the same algorithm. PP is slower not only because of Javascript, but also because of multithreading in PS.
BTW. I think my method corresponds to this: http://registry.gimp.org/node/24208
N*10 algorithm has an overhead, it needs a little more time (and memory) per pixel, but it does not depend on the radius. It is an exact algorithm (no approximation).
As far as I can tell the reason that Adobe can’t replace their current Photoshop bilateral filter implementation (which is now 15 years old or something) with a better one is that the precise pixel-level details would be slightly different, potentially affecting someone’s existing workflow.
This stuff should really be done using one of the fast GPU algorithms.
I really like your idea of having a "willitwork" page that dynamically lists the specific deficiencies in the user's browser. So many web applications just silently fail. This is way better. Every web application should have a willitwork page.
To detect the availability of the feature, I am chechking if the constructor is available, or if some property of an object is available. I never try to whitelist or blacklist any specific OS or a browser. I have never made any part of the code behave differently for some OS or some browser. But I have reported dozens of bugs to browser developers, most of them were fixed.
Photopea runs quite well on phones and tablets. If your microwave oven passes WillItWork, it will work on it too :)
FYI, Modernizr is a fantastic library for browser feature testing. You can just "add to cart" the tests you want to perform. No hand rolling necessary: https://modernizr.com/
Below 10px, your tool is the worst, from 10-30px, GIMP is awful, Photoshop is the best. Above 30px, your tool is the best. However, Photoshop doesn't seem to fall too far behind in actual seconds even as you approach 100px.
So do photo editing people typically use a smaller radius or larger radius, or does it just depend?
The picture in an example was made with a radius about 12px. But Photoshop and GIMP allow larger radii, so I think large radii are used sometimes, too.
BTW. it really surprised me, that Adobe Photoshop uses such a simple algorithm, while faster (and slightly more complex) algorithms exist for quite a long time.
also related are adobe's local laplacian filters: http://people.csail.mit.edu/hasinoff/pubs/ParisEtAl11-lapfil...
at recent SIGGRAPHs, they showed off the halide DSL which can optimize filtering/schedule of image processing kernels for CPUs/GPUs.
also pretty cool related algorithms are domain transform edge aware filters: http://www.inf.ufrgs.br/~eslgastal/DomainTransform/ if you use open cv, they're in 3.0 called DTFilter
In my experience with the art/design mac/photoshop crowd, something like GIMP only earns blank stares.
As tools go, Photoshop is pretty embedded, and most professional artists use it. Few professional artists use GIMP. (I've worked with lots of artists - this is just how things are. Most haven't even heard of it, and don't have any interest in it, which is fair enough, because most of the time it can't even load Photoshop files properly.)
Out of the artists that do use GIMP, professional or not, even fewer work on GIMP, as in, write the code that makes it do stuff. (Few artists have much inclination and/or talent when it comes to programming.)
This means that the intersection of people that write stuff for GIMP and people that use it is small; the intersection between GIMP programmers and GIMP professional users is tiny. So if there's something wrong with GIMP's implementation of stuff that professional artists use all the time, there's a good chance it won't even get noticed, let alone fixed.
I'm guessing a bit here about all of this stuff, I do admit. (How much insight do I have into the GIMP development process? None, of course.) But I've got good evidence for the theory, since most of the time GIMP can't even load Photoshop files properly! Even though that's, like, requirement #1 for anything that purports to be a useful tool for artists. GIMP is about as much use as a spreadsheet that can't open xslx files and has no OLE automation support.
I have seen much faster Surface Blur for GIMP available as a plugin. I am wondering, why it wasn't added as the default method.