GIMP Chat http://gimpchat.com/ |
|
GIMP's fast pixel operations http://gimpchat.com/viewtopic.php?f=9&t=20693 |
Page 1 of 1 |
Author: | trandoductin [ Tue Jan 02, 2024 8:52 am ] |
Post subject: | GIMP's fast pixel operations |
I googled this because I know it existed before and did it probably from this same page: Fast Pixel Ops in GIMP-Python (https://shallowsky.com/blog/gimp/pygimp-pixel-ops.html) But in the example there's a missing part which is updating the destination layer after the work has been done which is found at (https://github.com/akkana/gimp-plugins/ ... rclayer.py) by the same author which was linked in 1st post as well but I didn't know this when working with it so spent some time fighting. But it's this piece of code: Code: Select all destDrawable.flush() So together I created a test py that uses the above technique for fast pixel operations (code below): Have an image with 2 layers, select the layer you want to copy or flip 2 directions, vertical and horizontal Plug-in will allow you to choose a destination layer to have result shown on using fast pixel operations. That's it. it's SUPER FAST like about 1 second to do on a large 2000 x 2000 or so image. Code: Select all #!/usr/bin/env python |
Author: | ofnuts [ Tue Jan 02, 2024 1:25 pm ] |
Post subject: | Re: GIMP's fast pixel operations |
trandoductin wrote: I googled this because I know it existed before and did it probably from this same page: Fast Pixel Ops in GIMP-Python (https://shallowsky.com/blog/gimp/pygimp-pixel-ops.html) But in the example there's a missing part which is updating the destination layer after the work has been done which is found at (https://github.com/akkana/gimp-plugins/ ... rclayer.py) by the same author which was linked in 1st post as well but I didn't know this when working with it so spent some time fighting. But it's this piece of code: Code: Select all destDrawable.flush() So together I created a test py that uses the above technique for fast pixel operations (code below): Have an image with 2 layers, select the layer you want to copy or flip 2 directions, vertical and horizontal Plug-in will allow you to choose a destination layer to have result shown on using fast pixel operations. That's it. it's SUPER FAST like about 1 second to do on a large 2000 x 2000 or so image. Code: Select all #!/usr/bin/env python And it you use numpy to manipulate your arrays it is even faster. |
Author: | trandoductin [ Tue Jan 02, 2024 1:48 pm ] |
Post subject: | Re: GIMP's fast pixel operations |
ofnuts wrote: And it you use numpy to manipulate your arrays it is even faster. What? really? but numpy doesn't come standard in GIMP python. I don't know if it comes in newer GIMP. If it does would you please have sample code like above blog like just important chunks. Because if I can use numpy in GIMP python without having to tell users having to install numpy then I would definitely want to know how! Please. |
Author: | ofnuts [ Tue Jan 02, 2024 8:42 pm ] |
Post subject: | Re: GIMP's fast pixel operations |
trandoductin wrote: ofnuts wrote: And it you use numpy to manipulate your arrays it is even faster. What? really? but numpy doesn't come standard in GIMP python. I don't know if it comes in newer GIMP. If it does would you please have sample code like above blog like just important chunks. Because if I can use numpy in GIMP python without having to tell users having to install numpy then I would definitely want to know how! Please. Alas, you have to install numpy. But it can be really fast because operations on arrays are direct C code (when it is not contracted to the graphics card). I wrote experimental median & average filters (across layers) than run faster that thein GMIC equivalents. |
Author: | trandoductin [ Tue Jan 02, 2024 9:54 pm ] |
Post subject: | Re: GIMP's fast pixel operations |
ah that's too bad I wished GIMP would just include numpy automatically. |
Page 1 of 1 | All times are UTC - 5 hours [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |