Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Eager to learn how to draw pixel functions in GIMP python

Mon Jun 28, 2021 12:24 pm

Can anybody give me a sample on how to "draw pixel, loop and end the loop" on a layer?, using :

Code:
pdb.gimp_drawable_set_pixel(drawable, x_coord, y_coord, num_channels, pixel)

Re: Eager to learn how to draw pixel functions in GIMP python

Tue Jun 29, 2021 3:30 am

Don't... There is some overhead for these functions, and you have to call them several thousands times for a drawing. Even on a small image you can go for coffee while your script runs.

The "fast" interface is called "pixel regions". In one of my recent scripts, it was faster to paint a mask with a patern using a region that to use Gimp's pattern fill. Two examples of use:

My "ofn-tartan" script in https://sourceforge.net/projects/gimp-t ... s/scripts/ (see the "addmask" function)

My numpy tutorial (you don't need to use numpty of course): https://www.gimp-forum.net/Thread-Gimp-python-and-numpy

Re: Eager to learn how to draw pixel functions in GIMP python

Tue Jun 29, 2021 10:03 am

I understand what you're saying, thank you ofnuts. I will download them. Thanks again :coolthup
Post a reply