Band pass filter only for pixels inside a mask

How can i apply a band pass filter on subregions inside an image which can be denoted by either a mask or by geometry coordinates. The rest of the image should stay unchanged. I want to be able to do this for any kind of filter like blur etc

If you’re using the gimp plugin, you can choose the layer from the interface.

What about the gmic command line

Pinging again. To explain I want to apply the filters to a subregion of the image that would be a rectangle. I am looking for sample gmic command line to achieve this,.

I was going to suggest the inpaint option, but it looks like you’ve already explored that option.

A possible work around would be to copy the image, use imagemagick to crop it to the desired region, run gmic on the cropped image, then merge the cropped image back onto the original image.

Here is a generic way to proceed, from a mask :

gmic image.jpg 100%,100% -circle[-1] 50%,50%,120,1,1 --blur[0] 10 -j[0] [-1],0,0,0,0,1,[-2] -rm[-2,-1]

First you load the image to filter, then you create the mask, then compute the result of the filter, and finally you draw the result on the original image according to the masked region.

Thank you!

What does this do :
[-1],0,0,0,0,1,[-2]

And what does [-1] after circle do?

Please read the available documentation about the G’MIC scripting language, starting from here :

http://gmic.eu/tutorial/basics.shtml

All is explained better there that I could do here with a few words :slight_smile:

I am going through it and figured out most. But still unclear about [-1],0,0,0,0,1,[-2] . Can you point to the section in the documentation for it if not explanation :slight_smile:

It’s the arguments for the command -j (shortcut for -image ).
See reference doc of the command here : http://gmic.eu/reference.shtml#j to have a meaning of all those parameters.

Thanks. And what does the [-1] after circle do?

Its not documented in the documentation for circle etc

http://gmic.eu/tutorial/command-decorations.shtml

Thanks. Is there a way to have the effect of the filter as if it was applied with its center as the center of rectangle mask.

I don’t get the idea. Could you post an example of what you want precisely ?

i dont have a command line but I can explain. The radial blur filter when applied to an entire image gives impression of a radial blur whose center is the center of the image. For a mask, I want to have that effect as if the center of the blur was the center of the mask. While the rest of the image stays as is.

You can set the center in the arguments of the -blur_radial command : http://gmic.eu/reference.shtml#blur_radial