Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gimp, python, and numpy
#1
Numpy is one of the things that makes Python an "in" language according to this StackOverflow blog. But it can also be used outside of data science. In practice it is a very efficient vector/matrix library and so is well suited to process image data.

Together with the ability to extract "pixel regions" with the Gimp python API, some pretty fast processing can be written quickly. See attached script for some exemples: median/average filter (the median filter is almost twice as fast as the one in GMIC), and an implementation of Color>Desaturate>Luminosity. If done properly, there are no loops in Python, all the pixel iteration is done by the numpy code on native data.

Of course, you have to add the numpy module to the python runtime used by Gimp. Very easily done in Linux... it could be more complicated to do on Windows/OSX, but not impossible.

Edit: updated the script 2017-12-05 (now uses 2D rectangular color planes instead of single vector ones)


Attached Files
.zip   numpyops.zip (Size: 1.23 KB / Downloads: 667)
Reply


Messages In This Thread
Gimp, python, and numpy - by Ofnuts - 12-04-2017, 09:52 PM
RE: Gimp, python, and numpy - by Espermaschine - 12-06-2017, 12:23 AM
RE: Gimp, python, and numpy - by Ofnuts - 12-06-2017, 12:31 AM
RE: Gimp, python, and numpy - by Zero01 - 12-06-2017, 07:16 PM
RE: Gimp, python, and numpy - by Ofnuts - 12-06-2017, 11:26 PM
RE: Gimp, python, and numpy - by Zero01 - 12-07-2017, 12:29 PM
RE: Gimp, python, and numpy - by Ofnuts - 12-07-2017, 02:24 PM
RE: Gimp, python, and numpy - by dinasset - 12-07-2017, 08:57 AM
RE: Gimp, python, and numpy - by Ofnuts - 12-07-2017, 09:49 AM
RE: Gimp, python, and numpy - by Zero01 - 12-07-2017, 09:59 AM
RE: Gimp, python, and numpy - by dinasset - 12-07-2017, 10:24 AM
RE: Gimp, python, and numpy - by Ofnuts - 12-07-2017, 02:22 PM
RE: Gimp, python, and numpy - by Ofnuts - 12-07-2017, 12:57 PM
RE: Gimp, python, and numpy - by Zero01 - 12-07-2017, 01:14 PM
RE: Gimp, python, and numpy - by rich2005 - 12-07-2017, 01:26 PM
RE: Gimp, python, and numpy - by dinasset - 12-07-2017, 01:50 PM
RE: Gimp, python, and numpy - by Zero01 - 12-07-2017, 01:55 PM
RE: Gimp, python, and numpy - by Zero01 - 12-07-2017, 03:08 PM
RE: Gimp, python, and numpy - by Kevin - 12-07-2017, 03:09 PM
RE: Gimp, python, and numpy - by dinasset - 12-07-2017, 03:42 PM
RE: Gimp, python, and numpy - by Zero01 - 12-07-2017, 05:15 PM
RE: Gimp, python, and numpy - by Kevin - 12-07-2017, 05:33 PM
RE: Gimp, python, and numpy - by Zero01 - 12-07-2017, 05:57 PM
RE: Gimp, python, and numpy - by Ofnuts - 12-07-2017, 05:59 PM
RE: Gimp, python, and numpy - by Zero01 - 12-07-2017, 06:11 PM
RE: Gimp, python, and numpy - by Ofnuts - 12-07-2017, 06:33 PM
RE: Gimp, python, and numpy - by rich2005 - 12-07-2017, 06:41 PM
RE: Gimp, python, and numpy - by rich2005 - 12-08-2017, 11:08 AM
RE: Gimp, python, and numpy - by Zero01 - 12-10-2017, 12:33 PM

Forum Jump: