It is currently Wed Sep 16, 2026 11:03 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Timelapse window cleaner script
PostPosted: Sun Jan 22, 2012 9:53 am  (#1) 
Offline
New Member

Joined: Jan 22, 2012
Posts: 1
Hello all,

I started investigating this about a year ago, but got busy and abandoned it.
But I'm determined to get this done and have the finished script to share.

Scenario - I have a camera that I am using to take timelapse photos.
My camera is indoors, looking through a window that is hard to get at from the outside (and therefore hard to clean).

Which means that each photo has a few dirt spots in the same areas.

I am writing a script that will accept XY co-ords of dirt spots, then copy small patches from neighbouring areas and paste them over the dark dirt spots. Essentially, a heal tool.

The script so far is below, I am new at Script-Fu and cannot get a a simple function like delete/erase/clear to be performed on the image. I have tried many ways, trying to declare selections and drawables in different ways, etc...

I can be more detailed in my script attempts.
But first, can someone please help me out with erasing a selection?

(gimp-edit-clear (car(gimp-image-get-active-drawable openedImage)))
tried straightforward syntax like this.... I am missing something.

(set! drawableOfImage (car (gimp-image-get-active-layer openedImage)))
Don't know if this is deprecated.

How to erase a selection?
Once I get that figured, I should be able to work out more myself.
And produce a working script to share later on :-)

Thanks.


; ##################################
;
; this script is supposed to open an image,
; select a small feathered ellipse,
; then erase the area.
; And remove the "dirty flag" which indicates the opened work is unsaved.
; This makes it quicker to close the file file and run the script again.
;

(define (script-fu-timelapse1)

(let* (

(openedImage (car (gimp-file-load RUN-INTERACTIVE "C:\\img0001.jpg" "C:\\img0001.jpg")))
(drawableOfImage (car (gimp-image-get-active-layer openedImage)))
)

(gimp-display-new openedImage) ;display image in GIMP UI

(gimp-ellipse-select drawableOfImage 690 80 26 26 CHANNEL-OP-REPLACE 1 1 10) ;select an ellipse, feathered

(gimp-edit-clear openedImage) ;clear selected area of image.... doesn't work

;(gimp-edit-clear (car (gimp-image-get-active-drawable openedImage))) ;this doesn't work either

(gimp-image-clean-all image) ;removes dirty, work not saved flag

) ;let
) ;define


; ===================================

(script-fu-register
"script-fu-timelapse1" ;func name
"timelapse start" ;menu label
"window cleaner" ;description
"me" ;author
"copyleft 2012" ;copyright notice
"creation date" ;date created
"" ;image type that the script works on

SF-IMAGE ; operates on an open image
SF-DRAWABLE ; on an open image, refers to active layer
)

(script-fu-menu-register "script-fu-timelapse1" "<Image>/File/Foobar/Timelapse1")

; ##################################
; END OF FILE


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: Timelapse window cleaner script
PostPosted: Sun Jan 22, 2012 11:12 am  (#2) 
Offline
Script Coder
User avatar

Joined: Apr 23, 2010
Posts: 1553
Location: not from Guildford after all
(gimp-ellipse-select drawableOfImage 690 80 26 26 CHANNEL-OP-REPLACE 1 1 10) ;select an ellipse, feathered

This is not correct, "selections" are made on an image basis, the layer does not matter.
(gimp-edit-clear openedImage) ;clear selected area of image.... doesn't work

This is not correct. You want to clear the drawable, not the image*. As you do in the following:
;(gimp-edit-clear (car (gimp-image-get-active-drawable openedImage))) ;this doesn't work either

Assuming you have not commented out that line in your script (and you fix the selection), this should work.


* An "image" in GIMP parlance is merely a list of properties (width, height, name, type, etc) and links which point to the actual graphical elements of the image (layers, masks, and selections/channels -- i.e., "drawables"). You never "paint" or "draw" on the image per se, you always paint (or erase, or filter, or otherwise change the graphical content) on a "drawable" that belongs to the image.

_________________
Any sufficiently primitive technology is indistinguishable from a rock.


Top
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group