It is currently Thu Jul 04, 2024 5:04 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: How to use gimp_image_remove_channel in Python-Fu?
PostPosted: Sun Sep 07, 2014 12:23 pm  (#1) 
Offline
GimpChat Member

Joined: Jul 19, 2014
Posts: 31
Details here. What text would complete the first line here in order to define the alpha channel? image is already defined.

channel =
gimp.pdb.gimp_image_remove_channel(image,channel)


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: How to use gimp_image_remove_channel in Python-Fu?
PostPosted: Sun Sep 07, 2014 2:29 pm  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
You can't remove the alpha channel of the whole image that way. You have to use either:
image.flatten()
# or
pdb.gimp_image_flatten(image)

_________________
Image


Top
 Post subject: Re: How to use gimp_image_remove_channel in Python-Fu?
PostPosted: Sun Sep 07, 2014 3:43 pm  (#3) 
Offline
GimpChat Member

Joined: Jul 19, 2014
Posts: 31
What function is called by the menu item Layer > Transparency > Remove Alpha Channel?


Top
 Post subject: Re: How to use gimp_image_remove_channel in Python-Fu?
PostPosted: Sun Sep 07, 2014 3:54 pm  (#4) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
Likely none, if it's an internal function. Not all menus are plugins/scripts.

This said removing the alpha channel of a layer has little purpose...

_________________
Image


Top
 Post subject: Re: How to use gimp_image_remove_channel in Python-Fu?
PostPosted: Mon Sep 08, 2014 8:52 am  (#5) 
Offline
GimpChat Member

Joined: Feb 22, 2012
Posts: 295
Location: Germany
It calls "gimp_layer_flatten", which is indeed the procedure
to remove alpha channel from layer.


Top
 Post subject: Re: How to use gimp_image_remove_channel in Python-Fu?
PostPosted: Wed Oct 01, 2014 1:15 pm  (#6) 
Offline
GimpChat Member

Joined: Jul 19, 2014
Posts: 31
Onkel Hatti wrote:
It calls "gimp_layer_flatten"
Is this a guess, or did you check? Remove Alpha Channel works quickly and reliably with very large images. Flatten on the other hand takes a long time and frequently causes GIMP to crash with very large images.

If Remove Alpha Channel doesn't call gimp_image_remove_channel, what is gimp_image_remove_channel for and how do you use it?


Top
 Post subject: Re: How to use gimp_image_remove_channel in Python-Fu?
PostPosted: Wed Oct 01, 2014 2:46 pm  (#7) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
gimp_image_remove_channel() removes the channels you can add to the image (saved selections, etc...).

_________________
Image


Top
 Post subject: Re: How to use gimp_image_remove_channel in Python-Fu?
PostPosted: Wed Oct 01, 2014 3:47 pm  (#8) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
Lumo wrote:
Onkel Hatti wrote:
It calls "gimp_layer_flatten"
Is this a guess, or did you check?

Why the doubt?

Lumo wrote:
Remove Alpha Channel works quickly and reliably with very large images. Flatten on the other hand takes a long time and frequently causes GIMP to crash with very large images.

Flattening an image will definitely take longer than flattening a layer. There is much more happening when flattening an image.

Flattening an image consists of initiating an UNDO group, producing a new temporary layer to store the result, producing another new temporary layer filled with the background color, merging the layers taking into account blend modes, opacities, visibilities, offsets, boundaries, and any layermasks (as well as copying parasites and tattoos), positioning the new layer in the layerstack, deleting all of the original layers as well as the background layer, flattening the new layer, and ending the UNDO group.

Even if the image comprises only a single layer, doing all of those steps will take longer than the single step of flattening the original layer, which is a simple pixel-by-pixel compositing against a single color and storing it back into the original layer (flattening a layer is one of the steps that needs to be done when flattening the image, anyway).

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Remove Stain from Image

5

No new posts Attachment(s) AI Remove image background(use rembg)

49

No new posts Get a mouse click or select a pixel in an image in a python plugin?

3

No new posts Attachment(s) Add Alpha Channel to All Layers

1

No new posts Attachment(s) Alpha Channel not working

7



* Login  



Powered by phpBB3 © phpBB Group