Skip to content

Commit aa0a206

Browse files
committed
Add test files and require Pillow 6.0
1 parent 42dd0b5 commit aa0a206

File tree

5 files changed

+7
-18
lines changed

5 files changed

+7
-18
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ install_requires =
3232
click
3333
Jinja2
3434
Markdown
35-
Pillow>=4.0.0
35+
Pillow>=6.0.0
3636
pilkit
3737
natsort
3838

sigal/image.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,10 @@
4141
from PIL import Image as PILImage
4242
from PIL import ImageFile, ImageOps, IptcImagePlugin
4343
from PIL.ExifTags import GPSTAGS, TAGS
44+
from PIL.Image import Exif
4445
from pilkit.processors import Transpose
4546
from pilkit.utils import save_image
4647

47-
try:
48-
# Pillow 6.0 added a class allowing to write Exif data
49-
from PIL.Image import Exif
50-
except ImportError:
51-
Exif = None
52-
5348
from . import signals, utils
5449
from .settings import Status
5550

@@ -78,7 +73,7 @@ def _read_image(file_path):
7873
im = PILImage.open(file_path)
7974

8075
for w in caught_warnings:
81-
logger.warning(
76+
logger.info(
8277
f'PILImage reported a warning for file {file_path}\n'
8378
f'{w.category}: {w.message}'
8479
)
@@ -125,15 +120,8 @@ def generate_image(source, outname, settings, options=None):
125120
pass
126121
else:
127122
if copy_exif and 'exif' in options:
128-
if Exif is not None:
129-
# reset the orientation flag
130-
options['exif'][0x0112] = 1
131-
else:
132-
logger.warning(
133-
"'autorotate_images' and 'copy_exif_data' settings "
134-
"are not compatible when using Pillow < 6.0, because "
135-
"Sigal can't save the modified Orientation tag."
136-
)
123+
# reset the orientation flag
124+
options['exif'][0x0112] = 1
137125

138126
# Resize the image
139127
if settings['img_processor']:
137 KB
Loading

tests/sample/sigal.conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
keep_orig = True
66
thumb_video_delay = 5
77
# img_format = 'jpeg'
8+
copy_exif_data = True
89

910
links = [
1011
("Example link", "http://example.org"),

tests/test_extended_caching.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_save_cache(settings, tmpdir):
2121

2222
assert cache["exifTest/21.jpg"] == gal.albums["exifTest"].medias[0].exif
2323
assert cache["exifTest/22.jpg"] == gal.albums["exifTest"].medias[1].exif
24-
assert cache["exifTest/noexif.png"] == gal.albums["exifTest"].medias[2].exif
24+
assert cache["exifTest/noexif.png"] is None
2525

2626

2727
def test_restore_cache(settings, tmpdir):

0 commit comments

Comments
 (0)