Gimp-Forum.net
How to delete several channels? - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: How to delete several channels? (/Thread-How-to-delete-several-channels)



How to delete several channels? - Krikor - 01-08-2021

Is there any way to delete all channels at once? Or to delete the selected channels all at once?

I recently installed a plug-in and as an indirect result of its main function (Create luminosity Masks) it creates several channels in this process.

A created mask ends up producing about 6 channels.
If I apply the plug-in again to get another mask, or others, new channels are created in addition to the ones that already existed.

With three masks created I had 24 channels.

There was a moment when I already had 71 channels created, none of them being necessary, since in the process the masks are created in the layers windows.

I could not delete the channels at once. I don't know how or if it's possible to do that.

Thx.


RE: How to delete several channels? - rich2005 - 01-08-2021

Can't find a script for that, not to say there is not one.

A work-around to lose all those selection channels

Saul Goodes script http://chiselapp.com/user/saulgoode/repository/script-fu/wiki?name=sg-group-linked-layers

Group all the layers
Drag the layer group into tools for a new image
Un-group the layer group

example: https://i.imgur.com/0BygKPr.mp4


RE: How to delete several channels? - tmanni - 01-08-2021

There is no way to delete several channels in one action in 2.10.
You can do it only programmatically.
Open the python console menu Filters > Python-Fu > Console ; these 2 lines do the job (assuming you have only one image opened)
Code:
img = gimp.image_list()[0]
[img.remove_channel(c) for c in img.channels]



RE: How to delete several channels? - SOLVED - Krikor - 01-08-2021

Rich2005, you are a genius!  Idea

I tried CTRL+D, but it doesn't work because the channels are also duplicated. You found a brilliant alternative!
Thanks a lot!

(01-08-2021, 07:30 PM)tmanni Wrote: There is no way to delete several channels in one action in 2.10.
You can do it only programmatically.
Open the python console menu Filters > Python-Fu > Console ; these 2 lines do the job (assuming you have only one image opened)
Code:
img = gimp.image_list()[0]
[img.remove_channel(c) for c in img.channels]

Initially I had 5 open images; nothing happened. I left only one open and voilà !
[attachment=5449]
This command is extremely useful, I think that the Gimp should have this feature in a basic way, already embedded as an option in the official version.

Thanks a lot!


RE: How to delete several channels? - SOLVED - tmanni - 01-08-2021

(01-08-2021, 08:53 PM)Krikor Wrote: This command is extremely useful, I think that the Gimp should have this feature in a basic way, already embedded as an option in the official version.

Multi-selection of items (layers, channels, vectors...) is a incoming feature in gimp 3.0
https://www.gimp.org/news/2020/12/25/gimp-2-99-4-released/#multi-layer-selection


RE: How to delete several channels? - Ofnuts - 01-09-2021

(01-08-2021, 07:30 PM)tmanni Wrote: There is no way to delete several channels in one action in 2.10.
You can do it only programmatically.
Open the python console menu Filters > Python-Fu > Console ; these 2 lines do the job (assuming you have only one image opened)
Code:
img = gimp.image_list()[0]
[img.remove_channel(c) for c in img.channels]

Code golfing:

Code:
map(image.remove_channel,image.channels)

Smile


RE: How to delete several channels? - Ofnuts - 01-09-2021

(01-08-2021, 05:45 PM)Krikor Wrote: I recently installed a plug-in and as an indirect result of its main function (Create luminosity Masks) it creates several channels in this process.

A created mask ends up producing about 6 channels.
If I apply the plug-in again to get another mask, or others, new channels are created in addition to the ones that already existed.

Can I point out that there is no such problem with ofn-luminosity masks Smile