[Image-SIG] Enhancement patch for PILdriver
Eric S. Raymond
esr@golux.thyrsus.com
Thu, 9 Aug 2001 06:41:17 -0400
There's no submission address in the PIL distribution.
Diffs between last version checked in and current workfile(s):
--- README 2001/07/17 06:23:25 1.1
+++ README 2001/07/17 06:26:05
@@ -10,6 +10,13 @@
/F
--------------------------------------------------------------------
+pildriver.py
+
+A class implementing an image-processing calculator for scripts.
+Parses lists of commnds (or, called interactively, command-line
+arguments) into image loads, transformations, and saves.
+
+--------------------------------------------------------------------
viewer.py
A simple image viewer. Can display all file formats handled by
--- pildriver.py 2001/07/17 06:30:12 1.1
+++ pildriver.py 2001/07/17 06:59:12
@@ -22,7 +22,7 @@
space-separated tokens and passed to the execute method.
In the method descriptions below, a first line beginning with the string
-`usage:' means this method can be invokeed with the token that follows
+`usage:' means this method can be invoked with the token that follows
it. Following <>-enclosed arguments describe how the method interprets
the entries on the stack. Each argument specification begins with a
type specification: either `int', `float', `string', or `image'.
@@ -209,6 +209,26 @@
image = self.do_pop()
self.push(image.filter(filter))
+ def do_getbbox(self):
+ """usage: getbbox
+
+ Push left, upper, right, and lower pixel coordinates of the top image.
+ """
+ bounding_box = self.do_pop().getbbox()
+ self.push(bounding_box[3])
+ self.push(bounding_box[2])
+ self.push(bounding_box[1])
+ self.push(bounding_box[0])
+
+ def do_getextrema(self):
+ """usage: extrema
+
+ Push minimum and maximum pixel values of the top image.
+ """
+ extrema = self.do_pop().extrema()
+ self.push(extrema[1])
+ self.push(extrema[0])
+
def do_offset(self):
"""usage: offset <int:xoffset> <int:yoffset> <image:pic1>
@@ -218,7 +238,6 @@
yoff = int(self.do_pop())
image = self.do_pop()
self.push(image.offset(xoff, yoff))
-
def do_paste(self):
"""usage: paste <image:figure> <int:xoffset> <int:yoffset> <image:ground>
End of diffs.
--
<a href="http://www.tuxedo.org/~esr/">Eric S. Raymond</a>
Gun Control: The theory that a woman found dead in an alley, raped and
strangled with her panty hose, is somehow morally superior to a
woman explaining to police how her attacker got that fatal bullet wound.
-- L. Neil Smith