image lib supports arbitrary canvas coordinate

oyster lepto.python at gmail.com
Sun Jun 24 22:16:41 EDT 2012


Can any image(not for line plot, but for pixel set) lib behaves like a
person? that is to say:
when we are doing image processing( for exapmle,
http://www.freebasic.net/forum/viewtopic.php?f=17&t=20057&p=176300#p176300)
, the new image maybe have a bigger canvas size than the original
image's, and sometimes, nagative coordinate is needed from the
math-side viewpoint, Of cause, we can do which by pre-caculating the
proper canvas size, coordinate translation in code, but that is
tedious
Any lib can support some code like followings? thanks

[psedu-code]
newImg=Image.new('RGB', (200,300))   #begin with a canvas
size=200*300, so the x is between[0, 199], y is between [0, 299]
newImg.putpixel((500, 600), 'black')       #the lib expands the canvas
automatically, so till now the canvas size=501* 601
newImage.save('fin.jpg', border=(top=10, bottom=20, left=30,
right=40))                         #size of fin.jpg is
(501+30+40)*(601+10+20)

[/code]



More information about the Python-list mailing list