Post Reply 

script-fu undo

Jun 11, 2011, 11:53
Post: #1
script-fu undo
Hi all,

is there a procedure like ( gimp-image-undo image ) ?

What i'm trying to do is:

  1. load image
  2. do some operation to have a base of the image
    1. ( gimp-image-undo-group-start image )
    2. do some more operations with base image
    3. save this version of the image to filesytem
    4. ( gimp-image-undo-group-end image )
    5. ( gimp-image-undo image ) to get back to base

    1. ( gimp-image-undo-group-start image )
    2. do some more operations with base image
    3. save this version of the image to filesytem
    4. ( gimp-image-undo-group-end image )
    5. ( gimp-image-undo image ) to get back to base
  3. do other things


I'm using gimp in non-interactive mode.

Thanks in advance,
Hannes
Find all posts by this user
Quote this message in a reply
Jun 11, 2011, 12:30
Post: #2
RE: script-fu undo
I don't think so but you can duplicate the image (gimp-image-duplicate) instead, that would be less risky anyway. So that would be:

- load original image
- duplicate image
- work on duplicate
- save duplicate
- discard duplicate
- duplicate again...
- etc.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jun 11, 2011, 13:25 (This post was last modified: Jun 11, 2011 13:26 by haah.)
Post: #3
RE: script-fu undo
Thx for the quick response.

Do you know if the python api is richer than the scheme/script-fu api?
I am completely python noob, nonetheless should i switch to the python api?

Waiting for your advices,
Hannes
Find all posts by this user
Quote this message in a reply
Jun 11, 2011, 14:50
Post: #4
RE: script-fu undo
There are two things in the Python APIs you won't find in the Scheme one:

1) it defines useful object Classes: although not complete, the mere existence of Image/Layer/Drawable/Vectors classes (and some others) makes a lot of things simpler to write (the doc isn't very up to date, perusal of python's dir(object) to find useful methods and attributes is often required)

2) Besides scripts (which is what most people use it for) it can be used for full-power plugins, with image previews, etc. This requires some knowledge of pygtk (Python interface to GTK widgets) but can be a good alternative to C for some plugins.

Historically, Scheme was used because it puts a lot of power in a rather lightweight interpreter, but since the 90s this is no longer relevant. On the programming language side, I've not yet found a real-life Gimp script which is really easier to write in Scheme than in Python. The only thing Scheme has for it is that it's built-in, so you can expect a Scheme script to run everywhere. But Python is fairly well supported too, all Linux users have it and some Windows installers include it.

So, if its for you, use Python, and if you expect to publish, use Python too, if your script is palatable enough you'll make a few Python converts...

And the last nail in Scheme's coffin is that Python has a lot more uses outside of Gimp than Scheme (or Lisp). I learned Python by writing Gimp scripts and suddenly my job required to have Python skills...

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Jun 11, 2011, 15:12
Post: #5
RE: script-fu undo
Thank you for helping me!
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Create new images button & Save as override from Script-fu beniman 12 556 Sep 10, 2014 10:57
Last Post: paynekj
  Undo History - how does it work? richardfarr 2 364 Mar 20, 2014 23:21
Last Post: richardfarr
  Line Script 2Old 8 662 Feb 6, 2014 21:51
Last Post: ofnuts
  Script Fu Slandingo 1 725 Jun 14, 2013 20:26
Last Post: rich2005
  Gimp script SCM [Scale to/end at borders of] selection HalfNote5 6 1,025 Mar 15, 2013 00:49
Last Post: HalfNote5

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS