Merge pull request #708 from hugovk/single_image_dir

Put images in a single directory
This commit is contained in:
Alex Clark ☺ 2014-06-23 12:26:27 -04:00
commit 70a8337a4a
44 changed files with 39 additions and 39 deletions

View File

@ -396,7 +396,7 @@ w7IkEbzhVQAAAABJRU5ErkJggg==
if __name__ == "__main__":
# create font data chunk for embedding
import base64, os, sys
font = "../Images/courB08"
font = "../Tests/images/courB08"
print(" f._load_pilfont_data(")
print(" # %s" % os.path.basename(font))
print(" BytesIO(base64.decodestring(b'''")

View File

@ -233,7 +233,7 @@ def lena(mode="RGB", cache={}):
# im = cache.get(mode)
if im is None:
if mode == "RGB":
im = Image.open("Images/lena.ppm")
im = Image.open("Tests/images/lena.ppm")
elif mode == "F":
im = lena("L").convert(mode)
elif mode[:4] == "I;16":

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule
from PIL import Image
# sample ppm stream
file = "Images/lena.fli"
file = "Tests/images/lena.fli"
data = open(file, "rb").read()

View File

@ -5,7 +5,7 @@ from PIL import Image
codecs = dir(Image.core)
# sample gif stream
file = "Images/lena.gif"
file = "Tests/images/lena.gif"
with open(file, "rb") as f:
data = f.read()
@ -45,7 +45,7 @@ class TestFileGif(PillowTestCase):
def test_roundtrip2(self):
# see https://github.com/python-pillow/Pillow/issues/403
out = self.tempfile('temp.gif')
im = Image.open('Images/lena.gif')
im = Image.open('Tests/images/lena.gif')
im2 = im.copy()
im2.save(out)
reread = Image.open(out)
@ -55,7 +55,7 @@ class TestFileGif(PillowTestCase):
def test_palette_handling(self):
# see https://github.com/python-pillow/Pillow/issues/513
im = Image.open('Images/lena.gif')
im = Image.open('Tests/images/lena.gif')
im = im.convert('RGB')
im = im.resize((100, 100), Image.ANTIALIAS)

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule
from PIL import Image
# sample icon file
file = "Images/pillow.icns"
file = "Tests/images/pillow.icns"
data = open(file, "rb").read()
enable_jpeg2k = hasattr(Image.core, 'jp2klib_version')

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule
from PIL import Image
# sample ppm stream
file = "Images/lena.ico"
file = "Tests/images/lena.ico"
data = open(file, "rb").read()

View File

@ -8,7 +8,7 @@ from PIL import ImageFile
codecs = dir(Image.core)
test_file = "Images/lena.jpg"
test_file = "Tests/images/lena.jpg"
class TestFileJpeg(PillowTestCase):
@ -215,7 +215,7 @@ class TestFileJpeg(PillowTestCase):
self.assertEqual(info[305], 'Adobe Photoshop CS Macintosh')
def test_quality_keep(self):
im = Image.open("Images/lena.jpg")
im = Image.open("Tests/images/lena.jpg")
f = self.tempfile('temp.jpg')
im.save(f, quality='keep')

View File

@ -10,7 +10,7 @@ codecs = dir(Image.core)
# sample png stream
file = "Images/lena.png"
file = "Tests/images/lena.png"
data = open(file, "rb").read()
# stuff to create inline PNG images
@ -204,10 +204,10 @@ class TestFilePng(PillowTestCase):
def test_load_verify(self):
# Check open/load/verify exception (@PIL150)
im = Image.open("Images/lena.png")
im = Image.open("Tests/images/lena.png")
im.verify()
im = Image.open("Images/lena.png")
im = Image.open("Tests/images/lena.png")
im.load()
self.assertRaises(RuntimeError, lambda: im.verify())

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule
from PIL import Image
# sample ppm stream
file = "Images/lena.ppm"
file = "Tests/images/lena.ppm"
data = open(file, "rb").read()

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule
from PIL import Image
# sample ppm stream
file = "Images/lena.psd"
file = "Tests/images/lena.psd"
data = open(file, "rb").read()

View File

@ -5,7 +5,7 @@ from PIL import Image, TarIO
codecs = dir(Image.core)
# sample ppm stream
tarfile = "Images/lena.tar"
tarfile = "Tests/images/lena.tar"
class TestFileTar(PillowTestCase):

View File

@ -23,7 +23,7 @@ class TestFileWebp(PillowTestCase):
def test_read_rgb(self):
file_path = "Images/lena.webp"
file_path = "Tests/images/lena.webp"
image = Image.open(file_path)
self.assertEqual(image.mode, "RGB")
@ -33,7 +33,7 @@ class TestFileWebp(PillowTestCase):
image.getdata()
# generated with:
# dwebp -ppm ../../Images/lena.webp -o lena_webp_bits.ppm
# dwebp -ppm ../../Tests/images/lena.webp -o lena_webp_bits.ppm
target = Image.open('Tests/images/lena_webp_bits.ppm')
self.assert_image_similar(image, target, 20.0)

View File

@ -22,7 +22,7 @@ class TestFileWebpAlpha(PillowTestCase):
def test_read_rgba(self):
# Generated with `cwebp transparent.png -o transparent.webp`
file_path = "Images/transparent.webp"
file_path = "Tests/images/transparent.webp"
image = Image.open(file_path)
self.assertEqual(image.mode, "RGBA")
@ -33,7 +33,7 @@ class TestFileWebpAlpha(PillowTestCase):
image.tobytes()
target = Image.open('Images/transparent.png')
target = Image.open('Tests/images/transparent.png')
self.assert_image_similar(image, target, 20.0)
def test_write_lossless_rgb(self):

View File

@ -15,7 +15,7 @@ class TestFileWebpMetadata(PillowTestCase):
def test_read_exif_metadata(self):
file_path = "Images/flower.webp"
file_path = "Tests/images/flower.webp"
image = Image.open(file_path)
self.assertEqual(image.format, "WEBP")
@ -54,7 +54,7 @@ class TestFileWebpMetadata(PillowTestCase):
def test_read_icc_profile(self):
file_path = "Images/flower2.webp"
file_path = "Tests/images/flower2.webp"
image = Image.open(file_path)
self.assertEqual(image.format, "WEBP")

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule
from PIL import Image
# sample ppm stream
file = "Images/lena.xpm"
file = "Tests/images/lena.xpm"
data = open(file, "rb").read()

View File

@ -2,7 +2,7 @@ from helper import unittest, PillowTestCase, tearDownModule
from PIL import FontFile, BdfFontFile
filename = "Images/courB08.bdf"
filename = "Tests/images/courB08.bdf"
class TestFontBdf(PillowTestCase):

View File

@ -36,7 +36,7 @@ class TestImageConvert(PillowTestCase):
self.assertEqual(orig, converted)
def test_8bit(self):
im = Image.open('Images/lena.jpg')
im = Image.open('Tests/images/lena.jpg')
self._test_float_conversion(im.convert('L'))
def test_16bit(self):

View File

@ -3,7 +3,7 @@ from helper import unittest, PillowTestCase, tearDownModule, fromstring, tostrin
from PIL import Image
codecs = dir(Image.core)
filename = "Images/lena.jpg"
filename = "Tests/images/lena.jpg"
data = tostring(Image.open(filename).resize((512, 512)), "JPEG")

View File

@ -16,14 +16,14 @@ class TestImageLoad(PillowTestCase):
self.assertEqual(pix[0, 0], (223, 162, 133))
def test_close(self):
im = Image.open("Images/lena.gif")
im = Image.open("Tests/images/lena.gif")
im.close()
self.assertRaises(ValueError, lambda: im.load())
self.assertRaises(ValueError, lambda: im.getpixel((0, 0)))
def test_contextmanager(self):
fn = None
with Image.open("Images/lena.gif") as im:
with Image.open("Tests/images/lena.gif") as im:
fn = im.fp.fileno()
os.fstat(fn)

View File

@ -4,7 +4,7 @@ from PIL import Image
from PIL import ImageOps
from PIL import ImageFilter
im = Image.open("Images/lena.ppm")
im = Image.open("Tests/images/lena.ppm")
class TestImageOpsUsm(PillowTestCase):

View File

@ -19,7 +19,7 @@ import locale
# one of string.whitespace is not freely convertable into ascii.
path = "Images/lena.jpg"
path = "Tests/images/lena.jpg"
class TestLocale(PillowTestCase):

View File

@ -6,7 +6,7 @@ from PIL import Image
class TestPickle(PillowTestCase):
def helper_pickle_file(self, pickle, protocol=0):
im = Image.open('Images/lena.jpg')
im = Image.open('Tests/images/lena.jpg')
filename = self.tempfile('temp.pkl')
# Act
@ -19,7 +19,7 @@ class TestPickle(PillowTestCase):
self.assertEqual(im, loaded_im)
def helper_pickle_string(
self, pickle, protocol=0, file='Images/lena.jpg'):
self, pickle, protocol=0, file='Tests/images/lena.jpg'):
im = Image.open(file)
# Act

View File

@ -215,7 +215,7 @@ def lena(mode="RGB", cache={}):
im = cache.get(mode)
if im is None:
if mode == "RGB":
im = Image.open("Images/lena.ppm")
im = Image.open("Tests/images/lena.ppm")
elif mode == "F":
im = lena("L").convert(mode)
elif mode[:4] == "I;16":

View File

@ -9,7 +9,7 @@ try:
except:
format = "PNG"
im = Image.open("Images/lena.ppm")
im = Image.open("Tests/images/lena.ppm")
im.load()
queue = queue.Queue()

View File

@ -49,13 +49,13 @@ def testimage():
Or open existing files:
>>> im = Image.open(os.path.join(ROOT, "Images/lena.gif"))
>>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.gif"))
>>> _info(im)
('GIF', 'P', (128, 128))
>>> _info(Image.open(os.path.join(ROOT, "Images/lena.ppm")))
>>> _info(Image.open(os.path.join(ROOT, "Tests/images/lena.ppm")))
('PPM', 'RGB', (128, 128))
>>> try:
... _info(Image.open(os.path.join(ROOT, "Images/lena.jpg")))
... _info(Image.open(os.path.join(ROOT, "Tests/images/lena.jpg")))
... except IOError as v:
... print(v)
('JPEG', 'RGB', (128, 128))
@ -63,7 +63,7 @@ def testimage():
PIL doesn't actually load the image data until it's needed,
or you call the "load" method:
>>> im = Image.open(os.path.join(ROOT, "Images/lena.ppm"))
>>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.ppm"))
>>> print(im.im) # internal image attribute
None
>>> a = im.load()
@ -73,7 +73,7 @@ def testimage():
You can apply many different operations on images. Most
operations return a new image:
>>> im = Image.open(os.path.join(ROOT, "Images/lena.ppm"))
>>> im = Image.open(os.path.join(ROOT, "Tests/images/lena.ppm"))
>>> _info(im.convert("L"))
(None, 'L', (128, 128))
>>> _info(im.copy())