Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24412 > unrolled thread

image lib supports arbitrary canvas coordinate

Started byoyster <lepto.python@gmail.com>
First post2012-06-25 10:16 +0800
Last post2012-06-25 10:16 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  image lib supports arbitrary canvas coordinate oyster <lepto.python@gmail.com> - 2012-06-25 10:16 +0800

#24412 — image lib supports arbitrary canvas coordinate

Fromoyster <lepto.python@gmail.com>
Date2012-06-25 10:16 +0800
Subjectimage lib supports arbitrary canvas coordinate
Message-ID<mailman.1471.1340590604.4697.python-list@python.org>
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]

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web