RSS/Atom feed Twitter
Site is read-only, email is disabled

Batch - delete selection

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

Batch - delete selection xave 11 Dec 13:41
  Batch - delete selection David Gowers 11 Dec 14:28
   Batch - delete selection xave 11 Dec 16:47
  Batch - delete selection saulgoode@flashingtwelve.brickfilms.com 11 Dec 14:49
xave
2007-12-11 13:41:26 UTC (over 16 years ago)

Batch - delete selection

Bonjour,

I've got several images to put on the web and all have to be modified in the same way to blend with the website appearance. Being tired of clicking the same menu items several times, I'm trying to create a batch to do the job, but as it's my first one, I'm running into problems, can someone point me to what I'm doing wrong ?

What I'd like to do : select all, shrink the selection, rectangle round the selection, feather the selection, invert the selection, delete the selection, then save the file.

Here is my unfinished script (I'm adding one step at a time), I tried several ways to delete the selection to no avail, it always give me a "experienced a execution error" :

(define (test2 filename)
(let*
(
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) )
(gimp-selection-all image)
(gimp-selection-shrink image 3)
(let*
(
(selection (car (gimp-image-get-selection image))) )
(script-fu-selection-rounded-rectangle RUN-NONINTERACTIVE image selection 5) )

(gimp-selection-feather image 5)
(gimp-selection-invert image)

; everything seems to run until I add the following : (let*
(
(selection (car (gimp-image-get-selection image))) )
(gimp-drawable-delete selection)
)

)
)

Thanks for any help.

David Gowers
2007-12-11 14:28:14 UTC (over 16 years ago)

Batch - delete selection

Hi xave,

On Dec 11, 2007 11:11 PM, xave wrote:

Bonjour,

I've got several images to put on the web and all have to be modified in the same way to blend with the website appearance. Being tired of clicking the same menu items several times, I'm trying to create a batch to do the job, but as it's my first one, I'm running into problems, can someone point me to what I'm doing wrong ?

What I'd like to do : select all, shrink the selection, rectangle round the selection, feather the selection, invert the selection, delete the selection, then save the file.

Here is my unfinished script (I'm adding one step at a time), I tried several ways to delete the selection to no avail, it always give me a "experienced a execution error" :

(define (test2 filename)

(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) )
(gimp-selection-all image) (gimp-selection-shrink image 3) (let*
(
(selection (car (gimp-image-get-selection image))) )
(script-fu-selection-rounded-rectangle RUN-NONINTERACTIVE image selection 5) )

(gimp-selection-feather image 5) (gimp-selection-invert image)

; everything seems to run until I add the following : (let*
(
(selection (car (gimp-image-get-selection image))) )
(gimp-drawable-delete selection)

Deleting the selection is a VERY BAD thing to do! You probably want to delete the selected pixels instead. That is what gimp-edit-clear is for.

(gimp-edit-clear drawable)

where drawable is the layer you want to clear pixels from.

)

)
)

Thanks for any help.

-- xave

saulgoode@flashingtwelve.brickfilms.com
2007-12-11 14:49:09 UTC (over 16 years ago)

Batch - delete selection

What I'd like to do : select all, shrink the selection, rectangle round the selection, feather the selection, invert the selection, delete the selection, then save the file.

Here is my unfinished script (I'm adding one step at a time), I tried several ways to delete the selection to no avail, it always give me a "experienced a execution error" :

; everything seems to run until I add the following : (let*
(
(selection (car (gimp-image-get-selection image))) )
(gimp-drawable-delete selection)
)

You need to use 'gimp-edit-clear' to remove your feathered border region on your layer. You will need to use the 'gimp-image-get-active-layer' function to retrieve the drawable identifier of your layer.

When you retrieved the selection (using 'gimp-image-get-selection'), you actually obtained the drawable ID for the selection "mask" (this is an internal drawable which represents the selection of pixels as grayscale values). Since the drawable is internal to GIMP, you can not delete it -- nor would you want to, you want to clear the pixels of your drawable which are 'selected'.

xave
2007-12-11 16:47:42 UTC (over 16 years ago)

Batch - delete selection

Deleting the selection is a VERY BAD thing to do! You probably want to delete the selected pixels instead. That is what gimp-edit-clear is for.

(gimp-edit-clear drawable)

where drawable is the layer you want to clear pixels from.

\o/

It works like a charm, thanks a lot !