This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > PainShop Pro Scripting > January 2007 > Accessing pixel colours in a script
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Accessing pixel colours in a script
|
|
| BigBadDave 2007-01-10, 8:50 pm |
| Morning all, and seasons greetings.
Does anyone here know of a way that a script can access the pixel data
within an open image. I'm trying to write a script to perform actual pixel
processing from multiple layers.
I'm hoping that someone will tell me that there's a function that you pass
the X/Y coordinate, the layer number and whether you want sample-merged
pixel data or not, and have it return me an RGB triplet (or possibly RGBK).
That would be a nice Christmas pressy!
One obvious way is to use the "Eyedroper" command to read the pixel data
into the foreground or background swatch colour, then read it from there
using the "GetMaterial" command. I haven't actually tried doing that for a
whole image, but I'm guessing that it would be very slow.
As a 'C' programmer by trade, what I'd really like is a function that
returns a pointer to the layer memory itself, but I'm not sure that Python
can do very much with pointers anyway.
I guess I could save the layer to an external bitmap file, then fire off an
external application to perform the image processing before reading the
result file back into the layer, but that seems rather long winded.
Any help would be appreciated.
Dave
| |
| Ned Fleming 2007-01-10, 8:50 pm |
| BigBadDave wrote:
> Does anyone here know of a way that a script can access the pixel data
> within an open image. I'm trying to write a script to perform actual pixel
> processing from multiple layers.
I wonder if ImageMagick could be used:
http://www.imagemagick.org/script/api.php
and if it would do what you want. I've never used it, but it looks
pretty full-featured to me. Can one just "import" a (or any?)
library and have it available in PSP's Python?
It has a Python interface, among others, including C. Hmmm, I
wonder if Python could pass info to a C proggie and have it do the
heavy lifting? Where the data is in all this boggles me, though.
Ned
| |
| BigBadDave 2007-01-10, 8:50 pm |
|
"Ned Fleming" <nfleming@kaw.us> wrote in message
news:2pp4p2pm3ls7s51vmh6oibma90vmp3mefk@4ax.com...
> BigBadDave wrote:
>
>
> I wonder if ImageMagick could be used:
>
> http://www.imagemagick.org/script/api.php
>
> and if it would do what you want. I've never used it, but it looks
> pretty full-featured to me. Can one just "import" a (or any?)
> library and have it available in PSP's Python?
>
> It has a Python interface, among others, including C. Hmmm, I
> wonder if Python could pass info to a C proggie and have it do the
> heavy lifting? Where the data is in all this boggles me, though.
>
> Ned
>
Cool. Thanks Ned. I'll have a look at that. Sounds interesting.
Dave
| |
| Ned Fleming 2007-01-10, 8:50 pm |
| BigBadDave wrote:
[color=darkred]
>
> "Ned Fleming" <nfleming@kaw.us> wrote in message
> news:2pp4p2pm3ls7s51vmh6oibma90vmp3mefk@4ax.com...
It looks like GraphicsMagick -- a fork of ImageMagick -- might be
more stable API-wise and better supported in Python.
http://www.graphicsmagick.org/
|
|
|
| | Copyright 2003 - 2009 forum4designers.com Software forum Computer Hardware reviews |
|