Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #24412
| Date | 2012-06-25 10:16 +0800 |
|---|---|
| Subject | image lib supports arbitrary canvas coordinate |
| From | oyster <lepto.python@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1471.1340590604.4697.python-list@python.org> (permalink) |
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]
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
image lib supports arbitrary canvas coordinate oyster <lepto.python@gmail.com> - 2012-06-25 10:16 +0800
csiph-web