Open iamcarbon opened 7 years ago
This has been on my list for a while. I guess I'll get busy on it
I've got a whole bunch of code for that in ImageSharp that you can use to get started with. I'm sure you'll be able to improve on it though.
Thanks @JimBobSquarePants! I have the internals pretty well covered but I believe I'll have a look at what you've done and see if I can steal some ideas for the API shape :)
@iamcarbon I'm going to go ahead and expose the existing Gaussian Blur and Unsharp Mask filters I have internally (they'll give better quality than fixed blur/sharpen kernels), but I'm struggling a bit with how something like edge detection might fit in the MagicScaler pipeline. Most of the scenarios I can think of would require forking off a copy of the image to run the edge detection on and then using that to apply other changes back to the original image. Is that what you had in mind also, or am I overcomplicating that?
@saucecontrol Yeah, tricky. We have this working in ImageSharp now by rendering to an intermediate pixel buffer. Ideal case is that we can come up with some sort of line scanner matched to the kernel size that avoids allocating an intermediate target -- but will keep thinking on this.
In the meantime, our main use case is covered nicely with a simple Gaussian Blur Filter.
All righty, that sounds good. The current Unsharp Mask implementation is probably a good model for most types of masking operations. It uses sliding buffers (of the kernel size) to keep the original and blurred copies of the image lines and uses those to calculate the sharpened result to the output buffer. So the mechanics are already there... I'm just not sure how I'd expose something like that in the public API. I'll try and come up with another similar use case that I can plan around. Or if you have something specific already in mind, let me know, and I can try to build that out as a test case.
I'd also like to know exactly what you are trying to achieve here if that's alright so we can achieve the same.
It would be handy to support convolution filters (3x3 & 5x5, & 7x7) to support Blur, Sharpening, and Edge Detection Filters.