0

So, I'm using Python and I need to save pixel data to an .xls file like this: 1st column the row number, 2nd column the column number, 3rd column the colour. How am I supposed to do something like this? I know how to use .xls files with the xlrd and xlwt libs, but how can I get the data from my Gimp image?

Antoni4040
  • 2,297
  • 11
  • 44
  • 56
  • Is the image in Gimp's `XCF` format? If it is a more generic bitmap format, it's probably easier to use [PIL](http://pypi.python.org/pypi/PIL/1.1.6) (or its replacement [Pillow](http://pypi.python.org/pypi/Pillow/)). – Pedro Romano Oct 06 '12 at 18:47
  • Well, I'm trying to sync Gimp with Blender, so, probably not... :D – Antoni4040 Oct 06 '12 at 20:30

1 Answers1

2

Is the question on how to do it from within gimp? Otherwise, doing it using PIL is probably easier.

Anyway, if it is just a matter of saving, and if you know how to save the data to your required format once you have it, then writing a gimp-python plugin is what I would do. Getting individual pixel data is simple, but there are some particulars of gimp plugin syntax that you will need to have a look at. I would recommend looking at examples for that, see eg. http://gimpbook.com/scripting/ for Akkana Peck's excellent tutorials and links to further information.

skymandr
  • 150
  • 6