[Image-SIG] Misc observations....
Sun, 30 Mar 2003 02:14:19 +1100
Is there any reason why getbbox is:
getbbox() ==> tuple
getbbox( [color] ) ==> tuple
where color defaults to palette for 8bit images and (0,0,0) for rgb.
It doesnt look that hard to add to the code, but I thought
Id check before actually coding it. (For my use, speed isnt
important, so I just wrote it using image.getpixel, but it struck
me that this would be a useful modification for people who have
background colors other than black.)
Giving that working out the actual colors seems to be
secret hacker knowledge (I guess it had to be RGB or BGR so
its not that secret ;), but why not have a method like color32(r,g,b)
that returned the 'magic int' that is needed for 32 bit colors?
draw.line( ((10,10),(200,200)), fill=draw.color_rgb(200,10,50) )
is neater than:
draw.line( ((10,10),(200,200)), fill=(b<<16)+(g<<8)+r )
(unless Im missing some obvious way to do it).
I guess one could even have methods for 8 bit images such as:
draw.color_rgb(r,g,b) # allocate a new color palette
draw.color_find(r,g,b) # search for something near r,g,b in palette
Maybe I havnt played with 8bit pics enough, but palette
management seems to be less than easy.
still on palettes
I notice that anthony baxter, wrote back in 1996 about not
being able to set palettes...
Nothing ever came of that? Changing palette colors seems to
be either well hidden or left up to the user. Its easy to write
code to manipulate the palette string, but it just seems
that everyone must be writing the same code over and over.
I would have thought wanting to go:
would be something that lots of people would have wanted to
Other than having to write test code to work out what magic
color int's are etc, PIL seems pretty useful (and happy to
load and butcher my povray images :).
/ `Rev Dr' firstname.lastname@example.org Roleplaying, virtual goth \
< http://darkqueen.org Poly, *nix, Python, C/C++, genetics, ATM >
\ [+61 3] 9809 1523[h] skeptic, Evil GM(tm). Sysadmin for hire /
---------- Random Quote ----------
Maturity is only a short break in adolescence.
-- Jules Feiffer