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

How the UNDO system works?

This discussion is connected to the gimp-developer-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.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

How the UNDO system works? Piotr Legiecki 29 Oct 13:35
  How the UNDO system works? Michael Natterer 29 Oct 15:35
Piotr Legiecki
2003-10-29 13:35:08 UTC (about 21 years ago)

How the UNDO system works?

Hello

I wonder how the undo works in gimp?

I'm currently trying to write a little tool in java which operates on big files (70-120MB) and wonder how to make undo memory efficient.

Lets say I change something in Curves dialog in gimp. It takes effect on all pixels. So if I want to undo this operation, I have to have *all* the pixels before the operation. Right? So assuming 100MB image, the undo operation requires additional 100MB of space for one undo step. If I want to undo more such operations I would need image_size * undo_steps RAM for undo system?

I'm affraid this question looks naive, but I can't imagine that the algorithm I mentioned above works in gimp. I suspect it is a bit more clever.

Regards

Piotr L.

Michael Natterer
2003-10-29 15:35:24 UTC (about 21 years ago)

How the UNDO system works?

Piotr Legiecki writes:

Hello

I wonder how the undo works in gimp?

I'm currently trying to write a little tool in java which operates on big files (70-120MB) and wonder how to make undo memory efficient.

Lets say I change something in Curves dialog in gimp. It takes effect on all pixels. So if I want to undo this operation, I have to have *all* the pixels before the operation. Right?

Right, everything that gets dirtied by an operation must be pushed to the undo stack beforehand.

So assuming 100MB image,
the undo operation requires additional 100MB of space for one undo step. If I want to undo more such operations I would need image_size * undo_steps RAM for undo system?

Exactly, except it's not RAM but tile-cache that gets used for storing undo operations of pixel data. The maximum in-memory tile-cache size can be configured in preferences. Everything that does not fit in gets swapped out to the disk tile cache.

I'm affraid this question looks naive, but I can't imagine that the algorithm I mentioned above works in gimp. I suspect it is a bit more clever.

It works pretty well. I also can't think of something more efficient since we can hardly save less than the modified amout of pixels on the undo stack.

You can limit the size of the undo stack or even disable it completely when working on very large images.

ciao, --mitch