Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
re-coloured pixels hide confusingly
#4
(02-27-2026, 11:27 AM)cjel Wrote: ... Perhaps I've found a bug?

Possibly. I've just tried the following lines in the Script-fu console in both V3.0.8 and 3.2.0 rc 2 with the same results - the call of gimp-displays-flush has no effect:
Code:
(gimp-get-images)
(gimp-image-get-selected-drawables 1)
(gimp-drawable-set-pixel 2 1 2 '(0 0 0 0))
(gimp-displays-flush)

As a work-around you could add the following:

Code:
(gimp-item-set-visible 2 FALSE)
(gimp-item-set-visible 2 TRUE)


Calling  (gimp-image-is-dirty 1) after setting the pixel returns a value of 0 (in V3.2.0 rc 2) - so it looks as though this is a bug where the set pixel function isn't setting the dirty flag.

Update 1.3.2026

The GIMP source code says that the image dirty flag is not to be set explicitly. Instead an undo step should be created.

The issue, I think, comes down to the gim-drawable-set-pixel not registering as an undo step. If you use the function to set a pixel, turn the layer visibility off and on then the pixel appears but Edit/Undo only shows the visibility steps - you can't undo the set-pixel operation.

I'm wondering if this was a deliberate decision - it is likely that a script may set many pixels. If each setting caused an undo entry to be created you would overflow the undo stack.

The attached demo script shows two ways of making the pixel(s) appear. The drawing a line option could be replaced by any operation that creates an undo step (the script may have things to do apart from setting pixels). For your purposes the code that turns the layer visibility off/on may be more appropriate. Alternatively you could raise the issue with the developers (although I can find no record of anyone else raising this in the 30 years that GIMP has been around)

Further update:

I have changed the brush call for gimp-pencil - with a 1 pixel brush this will be the same as set-pixel but you can set more than one pixel at a time and it will be undoable. The downside is that it always draws with the foreground colour rather than being able to specify the colour in the set-pixel call.


.scm   SetPixel.scm (Size: 1.81 KB / Downloads: 29)
Reply


Messages In This Thread
re-coloured pixels hide confusingly - by cjel - 02-26-2026, 08:58 AM
RE: re-coloured pixels hide confusingly - by cjel - 02-27-2026, 11:27 AM
RE: re-coloured pixels hide confusingly - by programmer_ceds - 02-27-2026, 01:04 PM

Forum Jump: