How can I apply multiple "filters" in one ImageProcessor.Web request?

158 views Asked by At

I'm using the ImageProcessor.Web library in a .NET application. It is all working and seems great, but I'm wondering if there is a way to apply multiple filters (https://imageprocessor.org/imageprocessor-web/imageprocessingmodule/filter/) in the one request?

I'm specifically wanting to convert images to B&W, then invert them upon request: e.g. /myimage.jpg?filter=blackwhite&filter=invert

1

There are 1 answers

0
James South On BEST ANSWER

The System.Drawing ColorMatrix class does not provide methods to multiply matrices to combine values which is how filters would normally be combined.

https://learn.microsoft.com/en-us/dotnet/api/system.drawing.imaging.colormatrix?view=netframework-4.8

Because of this I never designed the filter rules to allow for multiple combined requests.

However, there is nothing to stop you implementing and registering your own IWebGraphicsProcessor that allowed combining the commands into a single command.