Skip to content

Commit

Permalink
Abandon de PIL
Browse files Browse the repository at this point in the history
  • Loading branch information
izneo-get committed Jun 6, 2022
1 parent e6252ca commit b187f30
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 4 additions & 5 deletions Scrapers/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from urllib3.util import Retry
import re
import os
from PIL import Image
import glob
import sys
import shutil
Expand Down Expand Up @@ -92,10 +91,10 @@ def convert_images(folder, format, quality=100, crop=False):
for filename in all_files:
new_filename = os.path.splitext(filename)[0] + '.' + format
if not crop:
im = Image.open(filename)
if format in ("jpeg") and im.mode in ("RGBA", "P"):
im = im.convert("RGB")
im.save(new_filename, format, quality=quality)
img = cv2.imdecode(
np.fromfile(filename, dtype=np.uint8), cv2.IMREAD_UNCHANGED
)
Scraper.save_img(img, new_filename, format, quality)
else:
img = Scraper.auto_crop(filename)
Scraper.save_img(img, new_filename, format, quality)
Expand Down
6 changes: 2 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
numpy==1.21.4+vanilla
Pillow==9.1.1
requests==2.22.0
requests==2.27.1
tabulate==0.8.9
urllib3==1.25.3
urllib3==1.26.9

0 comments on commit b187f30

Please sign in to comment.