mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-07 21:33:28 +03:00
Merge remote-tracking branch 'upstream/master' into Image
This commit is contained in:
commit
466fd9ec28
17
CHANGES.rst
17
CHANGES.rst
|
@ -4,10 +4,10 @@ Changelog (Pillow)
|
||||||
2.6.0 (unreleased)
|
2.6.0 (unreleased)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
- Fixed install issue if Multiprocessing.Pool is not available
|
- Added docs for ExifTags
|
||||||
[wiredfool]
|
[Wintermute3]
|
||||||
|
|
||||||
- More tests for ImageFont and _util
|
- More tests for ImageFont, ImageMath, and _util
|
||||||
[hugovk]
|
[hugovk]
|
||||||
|
|
||||||
- Fix return value of FreeTypeFont.textsize() does not include font offsets
|
- Fix return value of FreeTypeFont.textsize() does not include font offsets
|
||||||
|
@ -16,15 +16,20 @@ Changelog (Pillow)
|
||||||
- Fix dispose calculations for animated GIFs #765
|
- Fix dispose calculations for animated GIFs #765
|
||||||
[larsjsol]
|
[larsjsol]
|
||||||
|
|
||||||
- 32bit mult overflow fix #782
|
|
||||||
[wiredfool]
|
|
||||||
|
|
||||||
- Added class checking to Image __eq__ function #775
|
- Added class checking to Image __eq__ function #775
|
||||||
[radarhere, hugovk]
|
[radarhere, hugovk]
|
||||||
|
|
||||||
- Test PalmImagePlugin and method to skip known bad tests #776
|
- Test PalmImagePlugin and method to skip known bad tests #776
|
||||||
[hugovk, wiredfool]
|
[hugovk, wiredfool]
|
||||||
|
|
||||||
|
2.5.1 (2014-07-10)
|
||||||
|
------------------
|
||||||
|
|
||||||
|
- Fixed install issue if Multiprocessing.Pool is not available
|
||||||
|
[wiredfool]
|
||||||
|
|
||||||
|
- 32bit mult overflow fix #782
|
||||||
|
[wiredfool]
|
||||||
|
|
||||||
2.5.0 (2014-07-01)
|
2.5.0 (2014-07-01)
|
||||||
------------------
|
------------------
|
||||||
|
|
|
@ -26,9 +26,11 @@ except ImportError:
|
||||||
|
|
||||||
VERBOSE = 0
|
VERBOSE = 0
|
||||||
|
|
||||||
|
|
||||||
def _isconstant(v):
|
def _isconstant(v):
|
||||||
return isinstance(v, int) or isinstance(v, float)
|
return isinstance(v, int) or isinstance(v, float)
|
||||||
|
|
||||||
|
|
||||||
class _Operand:
|
class _Operand:
|
||||||
# wraps an image operand, providing standard operators
|
# wraps an image operand, providing standard operators
|
||||||
|
|
||||||
|
@ -68,20 +70,25 @@ class _Operand:
|
||||||
im2 = self.__fixup(im2)
|
im2 = self.__fixup(im2)
|
||||||
if im1.mode != im2.mode:
|
if im1.mode != im2.mode:
|
||||||
# convert both arguments to floating point
|
# convert both arguments to floating point
|
||||||
if im1.mode != "F": im1 = im1.convert("F")
|
if im1.mode != "F":
|
||||||
if im2.mode != "F": im2 = im2.convert("F")
|
im1 = im1.convert("F")
|
||||||
|
if im2.mode != "F":
|
||||||
|
im2 = im2.convert("F")
|
||||||
if im1.mode != im2.mode:
|
if im1.mode != im2.mode:
|
||||||
raise ValueError("mode mismatch")
|
raise ValueError("mode mismatch")
|
||||||
if im1.size != im2.size:
|
if im1.size != im2.size:
|
||||||
# crop both arguments to a common size
|
# crop both arguments to a common size
|
||||||
size = (min(im1.size[0], im2.size[0]),
|
size = (min(im1.size[0], im2.size[0]),
|
||||||
min(im1.size[1], im2.size[1]))
|
min(im1.size[1], im2.size[1]))
|
||||||
if im1.size != size: im1 = im1.crop((0, 0) + size)
|
if im1.size != size:
|
||||||
if im2.size != size: im2 = im2.crop((0, 0) + size)
|
im1 = im1.crop((0, 0) + size)
|
||||||
|
if im2.size != size:
|
||||||
|
im2 = im2.crop((0, 0) + size)
|
||||||
out = Image.new(mode or im1.mode, size, None)
|
out = Image.new(mode or im1.mode, size, None)
|
||||||
else:
|
else:
|
||||||
out = Image.new(mode or im1.mode, im1.size, None)
|
out = Image.new(mode or im1.mode, im1.size, None)
|
||||||
im1.load(); im2.load()
|
im1.load()
|
||||||
|
im2.load()
|
||||||
try:
|
try:
|
||||||
op = getattr(_imagingmath, op+"_"+im1.mode)
|
op = getattr(_imagingmath, op+"_"+im1.mode)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -101,34 +108,47 @@ class _Operand:
|
||||||
|
|
||||||
def __abs__(self):
|
def __abs__(self):
|
||||||
return self.apply("abs", self)
|
return self.apply("abs", self)
|
||||||
|
|
||||||
def __pos__(self):
|
def __pos__(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __neg__(self):
|
def __neg__(self):
|
||||||
return self.apply("neg", self)
|
return self.apply("neg", self)
|
||||||
|
|
||||||
# binary operators
|
# binary operators
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
return self.apply("add", self, other)
|
return self.apply("add", self, other)
|
||||||
|
|
||||||
def __radd__(self, other):
|
def __radd__(self, other):
|
||||||
return self.apply("add", other, self)
|
return self.apply("add", other, self)
|
||||||
|
|
||||||
def __sub__(self, other):
|
def __sub__(self, other):
|
||||||
return self.apply("sub", self, other)
|
return self.apply("sub", self, other)
|
||||||
|
|
||||||
def __rsub__(self, other):
|
def __rsub__(self, other):
|
||||||
return self.apply("sub", other, self)
|
return self.apply("sub", other, self)
|
||||||
|
|
||||||
def __mul__(self, other):
|
def __mul__(self, other):
|
||||||
return self.apply("mul", self, other)
|
return self.apply("mul", self, other)
|
||||||
|
|
||||||
def __rmul__(self, other):
|
def __rmul__(self, other):
|
||||||
return self.apply("mul", other, self)
|
return self.apply("mul", other, self)
|
||||||
|
|
||||||
def __truediv__(self, other):
|
def __truediv__(self, other):
|
||||||
return self.apply("div", self, other)
|
return self.apply("div", self, other)
|
||||||
|
|
||||||
def __rtruediv__(self, other):
|
def __rtruediv__(self, other):
|
||||||
return self.apply("div", other, self)
|
return self.apply("div", other, self)
|
||||||
|
|
||||||
def __mod__(self, other):
|
def __mod__(self, other):
|
||||||
return self.apply("mod", self, other)
|
return self.apply("mod", self, other)
|
||||||
|
|
||||||
def __rmod__(self, other):
|
def __rmod__(self, other):
|
||||||
return self.apply("mod", other, self)
|
return self.apply("mod", other, self)
|
||||||
|
|
||||||
def __pow__(self, other):
|
def __pow__(self, other):
|
||||||
return self.apply("pow", self, other)
|
return self.apply("pow", self, other)
|
||||||
|
|
||||||
def __rpow__(self, other):
|
def __rpow__(self, other):
|
||||||
return self.apply("pow", other, self)
|
return self.apply("pow", other, self)
|
||||||
|
|
||||||
|
@ -142,54 +162,77 @@ class _Operand:
|
||||||
# bitwise
|
# bitwise
|
||||||
def __invert__(self):
|
def __invert__(self):
|
||||||
return self.apply("invert", self)
|
return self.apply("invert", self)
|
||||||
|
|
||||||
def __and__(self, other):
|
def __and__(self, other):
|
||||||
return self.apply("and", self, other)
|
return self.apply("and", self, other)
|
||||||
|
|
||||||
def __rand__(self, other):
|
def __rand__(self, other):
|
||||||
return self.apply("and", other, self)
|
return self.apply("and", other, self)
|
||||||
|
|
||||||
def __or__(self, other):
|
def __or__(self, other):
|
||||||
return self.apply("or", self, other)
|
return self.apply("or", self, other)
|
||||||
|
|
||||||
def __ror__(self, other):
|
def __ror__(self, other):
|
||||||
return self.apply("or", other, self)
|
return self.apply("or", other, self)
|
||||||
|
|
||||||
def __xor__(self, other):
|
def __xor__(self, other):
|
||||||
return self.apply("xor", self, other)
|
return self.apply("xor", self, other)
|
||||||
|
|
||||||
def __rxor__(self, other):
|
def __rxor__(self, other):
|
||||||
return self.apply("xor", other, self)
|
return self.apply("xor", other, self)
|
||||||
|
|
||||||
def __lshift__(self, other):
|
def __lshift__(self, other):
|
||||||
return self.apply("lshift", self, other)
|
return self.apply("lshift", self, other)
|
||||||
|
|
||||||
def __rshift__(self, other):
|
def __rshift__(self, other):
|
||||||
return self.apply("rshift", self, other)
|
return self.apply("rshift", self, other)
|
||||||
|
|
||||||
# logical
|
# logical
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return self.apply("eq", self, other)
|
return self.apply("eq", self, other)
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
return self.apply("ne", self, other)
|
return self.apply("ne", self, other)
|
||||||
|
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return self.apply("lt", self, other)
|
return self.apply("lt", self, other)
|
||||||
|
|
||||||
def __le__(self, other):
|
def __le__(self, other):
|
||||||
return self.apply("le", self, other)
|
return self.apply("le", self, other)
|
||||||
|
|
||||||
def __gt__(self, other):
|
def __gt__(self, other):
|
||||||
return self.apply("gt", self, other)
|
return self.apply("gt", self, other)
|
||||||
|
|
||||||
def __ge__(self, other):
|
def __ge__(self, other):
|
||||||
return self.apply("ge", self, other)
|
return self.apply("ge", self, other)
|
||||||
|
|
||||||
|
|
||||||
# conversions
|
# conversions
|
||||||
def imagemath_int(self):
|
def imagemath_int(self):
|
||||||
return _Operand(self.im.convert("I"))
|
return _Operand(self.im.convert("I"))
|
||||||
|
|
||||||
|
|
||||||
def imagemath_float(self):
|
def imagemath_float(self):
|
||||||
return _Operand(self.im.convert("F"))
|
return _Operand(self.im.convert("F"))
|
||||||
|
|
||||||
|
|
||||||
# logical
|
# logical
|
||||||
def imagemath_equal(self, other):
|
def imagemath_equal(self, other):
|
||||||
return self.apply("eq", self, other, mode="I")
|
return self.apply("eq", self, other, mode="I")
|
||||||
|
|
||||||
|
|
||||||
def imagemath_notequal(self, other):
|
def imagemath_notequal(self, other):
|
||||||
return self.apply("ne", self, other, mode="I")
|
return self.apply("ne", self, other, mode="I")
|
||||||
|
|
||||||
|
|
||||||
def imagemath_min(self, other):
|
def imagemath_min(self, other):
|
||||||
return self.apply("min", self, other)
|
return self.apply("min", self, other)
|
||||||
|
|
||||||
|
|
||||||
def imagemath_max(self, other):
|
def imagemath_max(self, other):
|
||||||
return self.apply("max", self, other)
|
return self.apply("max", self, other)
|
||||||
|
|
||||||
|
|
||||||
def imagemath_convert(self, mode):
|
def imagemath_convert(self, mode):
|
||||||
return _Operand(self.im.convert(mode))
|
return _Operand(self.im.convert(mode))
|
||||||
|
|
||||||
|
|
|
@ -15,19 +15,19 @@ LUT_SIZE = 1 << 9
|
||||||
class LutBuilder:
|
class LutBuilder:
|
||||||
"""A class for building a MorphLut from a descriptive language
|
"""A class for building a MorphLut from a descriptive language
|
||||||
|
|
||||||
The input patterns is a list of a strings sequences like these:
|
The input patterns is a list of a strings sequences like these::
|
||||||
|
|
||||||
4:(...
|
4:(...
|
||||||
.1.
|
.1.
|
||||||
111)->1
|
111)->1
|
||||||
|
|
||||||
(whitespaces including linebreaks are ignored). The option 4
|
(whitespaces including linebreaks are ignored). The option 4
|
||||||
describes a series of symmetry operations (in this case a
|
describes a series of symmetry operations (in this case a
|
||||||
4-rotation), the pattern is described by:
|
4-rotation), the pattern is described by:
|
||||||
|
|
||||||
. or X - Ignore
|
- . or X - Ignore
|
||||||
1 - Pixel is on
|
- 1 - Pixel is on
|
||||||
0 - Pixel is off
|
- 0 - Pixel is off
|
||||||
|
|
||||||
The result of the operation is described after "->" string.
|
The result of the operation is described after "->" string.
|
||||||
|
|
||||||
|
@ -35,15 +35,16 @@ class LutBuilder:
|
||||||
returned if no other match is found.
|
returned if no other match is found.
|
||||||
|
|
||||||
Operations:
|
Operations:
|
||||||
4 - 4 way rotation
|
|
||||||
N - Negate
|
- 4 - 4 way rotation
|
||||||
1 - Dummy op for no other operation (an op must always be given)
|
- N - Negate
|
||||||
M - Mirroring
|
- 1 - Dummy op for no other operation (an op must always be given)
|
||||||
|
- M - Mirroring
|
||||||
|
|
||||||
Example:
|
Example::
|
||||||
|
|
||||||
lb = LutBuilder(patterns = ["4:(... .1. 111)->1"])
|
lb = LutBuilder(patterns = ["4:(... .1. 111)->1"])
|
||||||
lut = lb.build_lut()
|
lut = lb.build_lut()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, patterns=None, op_name=None):
|
def __init__(self, patterns=None, op_name=None):
|
||||||
|
|
|
@ -14,9 +14,13 @@ def pixel(im):
|
||||||
|
|
||||||
A = Image.new("L", (1, 1), 1)
|
A = Image.new("L", (1, 1), 1)
|
||||||
B = Image.new("L", (1, 1), 2)
|
B = Image.new("L", (1, 1), 2)
|
||||||
|
Z = Image.new("L", (1, 1), 0) # Z for zero
|
||||||
F = Image.new("F", (1, 1), 3)
|
F = Image.new("F", (1, 1), 3)
|
||||||
I = Image.new("I", (1, 1), 4)
|
I = Image.new("I", (1, 1), 4)
|
||||||
|
|
||||||
|
A2 = A.resize((2, 2))
|
||||||
|
B2 = B.resize((2, 2))
|
||||||
|
|
||||||
images = {"A": A, "B": B, "F": F, "I": I}
|
images = {"A": A, "B": B, "F": F, "I": I}
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,6 +75,112 @@ class TestImageMath(PillowTestCase):
|
||||||
self.assertEqual(pixel(ImageMath.eval("A == 1", images)), "I 1")
|
self.assertEqual(pixel(ImageMath.eval("A == 1", images)), "I 1")
|
||||||
self.assertEqual(pixel(ImageMath.eval("A == 2", images)), "I 0")
|
self.assertEqual(pixel(ImageMath.eval("A == 2", images)), "I 0")
|
||||||
|
|
||||||
|
def test_one_image_larger(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A+B", A=A2, B=B)), "I 3")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A+B", A=A, B=B2)), "I 3")
|
||||||
|
|
||||||
|
def test_abs(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("abs(A)", A=A)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("abs(B)", B=B)), "I 2")
|
||||||
|
|
||||||
|
def test_binary_mod(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A%A", A=A)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B%B", B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A%B", A=A, B=B)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B%A", A=A, B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z%A", A=A, Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z%B", B=B, Z=Z)), "I 0")
|
||||||
|
|
||||||
|
def test_bitwise_invert(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("~Z", Z=Z)), "I -1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("~A", A=A)), "I -2")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("~B", B=B)), "I -3")
|
||||||
|
|
||||||
|
def test_bitwise_and(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z&Z", A=A, Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z&A", A=A, Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A&Z", A=A, Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A&A", A=A, Z=Z)), "I 1")
|
||||||
|
|
||||||
|
def test_bitwise_or(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z|Z", A=A, Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z|A", A=A, Z=Z)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A|Z", A=A, Z=Z)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A|A", A=A, Z=Z)), "I 1")
|
||||||
|
|
||||||
|
def test_bitwise_xor(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z^Z", A=A, Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z^A", A=A, Z=Z)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A^Z", A=A, Z=Z)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A^A", A=A, Z=Z)), "I 0")
|
||||||
|
|
||||||
|
def test_bitwise_leftshift(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z<<0", Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z<<1", Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A<<0", A=A)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A<<1", A=A)), "I 2")
|
||||||
|
|
||||||
|
def test_bitwise_rightshift(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z>>0", Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("Z>>1", Z=Z)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A>>0", A=A)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A>>1", A=A)), "I 0")
|
||||||
|
|
||||||
|
def test_logical_eq(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A==A", A=A)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B==B", B=B)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A==B", A=A, B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B==A", A=A, B=B)), "I 0")
|
||||||
|
|
||||||
|
def test_logical_ne(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A!=A", A=A)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B!=B", B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A!=B", A=A, B=B)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B!=A", A=A, B=B)), "I 1")
|
||||||
|
|
||||||
|
def test_logical_lt(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A<A", A=A)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B<B", B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A<B", A=A, B=B)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B<A", A=A, B=B)), "I 0")
|
||||||
|
|
||||||
|
def test_logical_le(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A<=A", A=A)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B<=B", B=B)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A<=B", A=A, B=B)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B<=A", A=A, B=B)), "I 0")
|
||||||
|
|
||||||
|
def test_logical_gt(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A>A", A=A)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B>B", B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A>B", A=A, B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B>A", A=A, B=B)), "I 1")
|
||||||
|
|
||||||
|
def test_logical_ge(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A>=A", A=A)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B>=B", B=B)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("A>=B", A=A, B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("B>=A", A=A, B=B)), "I 1")
|
||||||
|
|
||||||
|
def test_logical_equal(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("equal(A, A)", A=A)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("equal(B, B)", B=B)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("equal(Z, Z)", Z=Z)), "I 1")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("equal(A, B)", A=A, B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("equal(B, A)", A=A, B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("equal(A, Z)", A=A, Z=Z)), "I 0")
|
||||||
|
|
||||||
|
def test_logical_not_equal(self):
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("notequal(A, A)", A=A)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("notequal(B, B)", B=B)), "I 0")
|
||||||
|
self.assertEqual(pixel(ImageMath.eval("notequal(Z, Z)", Z=Z)), "I 0")
|
||||||
|
self.assertEqual(
|
||||||
|
pixel(ImageMath.eval("notequal(A, B)", A=A, B=B)), "I 1")
|
||||||
|
self.assertEqual(
|
||||||
|
pixel(ImageMath.eval("notequal(B, A)", A=A, B=B)), "I 1")
|
||||||
|
self.assertEqual(
|
||||||
|
pixel(ImageMath.eval("notequal(A, Z)", A=A, Z=Z)), "I 1")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
16
docs/PIL.rst
16
docs/PIL.rst
|
@ -20,14 +20,6 @@ can be found here.
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
:mod:`ExifTags` Module
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
.. automodule:: PIL.ExifTags
|
|
||||||
:members:
|
|
||||||
:undoc-members:
|
|
||||||
:show-inheritance:
|
|
||||||
|
|
||||||
:mod:`FontFile` Module
|
:mod:`FontFile` Module
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
@ -86,6 +78,14 @@ can be found here.
|
||||||
:undoc-members:
|
:undoc-members:
|
||||||
:show-inheritance:
|
:show-inheritance:
|
||||||
|
|
||||||
|
:mod:`ImageMorph` Module
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
.. automodule:: PIL.ImageMorph
|
||||||
|
:members:
|
||||||
|
:undoc-members:
|
||||||
|
:show-inheritance:
|
||||||
|
|
||||||
:mod:`ImageShow` Module
|
:mod:`ImageShow` Module
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
26
docs/reference/ExifTags.rst
Normal file
26
docs/reference/ExifTags.rst
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
.. py:module:: PIL.ExifTags
|
||||||
|
.. py:currentmodule:: PIL.ExifTags
|
||||||
|
|
||||||
|
:py:mod:`ExifTags` Module
|
||||||
|
==========================
|
||||||
|
|
||||||
|
The :py:mod:`ExifTags` module exposes two dictionaries which
|
||||||
|
provide constants and clear-text names for various well-known EXIF tags.
|
||||||
|
|
||||||
|
.. py:class:: PIL.ExifTags.TAGS
|
||||||
|
|
||||||
|
The TAG dictionary maps 16-bit integer EXIF tag enumerations to
|
||||||
|
descriptive string names. For instance:
|
||||||
|
|
||||||
|
>>> from PIL.ExifTags import TAGS
|
||||||
|
>>> TAGS[0x010e]
|
||||||
|
'ImageDescription'
|
||||||
|
|
||||||
|
.. py:class:: PIL.ExifTags.GPSTAGS
|
||||||
|
|
||||||
|
The GPSTAGS dictionary maps 8-bit integer EXIF gps enumerations to
|
||||||
|
descriptive string names. For instance:
|
||||||
|
|
||||||
|
>>> from PIL.ExifTags import GPSTAGS
|
||||||
|
>>> GPSTAGS[20]
|
||||||
|
'GPSDestLatitude'
|
|
@ -4,6 +4,7 @@ Reference
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
|
||||||
Image
|
Image
|
||||||
ImageChops
|
ImageChops
|
||||||
ImageColor
|
ImageColor
|
||||||
|
@ -22,5 +23,6 @@ Reference
|
||||||
ImageStat
|
ImageStat
|
||||||
ImageTk
|
ImageTk
|
||||||
ImageWin
|
ImageWin
|
||||||
|
ExifTags
|
||||||
PSDraw
|
PSDraw
|
||||||
../PIL
|
../PIL
|
||||||
|
|
Loading…
Reference in New Issue
Block a user