Loading bin/pyggle +55 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ from progress.bar import Bar import shutil import subprocess import sys import tempfile geocoder = None location_cache = dict() Loading Loading @@ -294,7 +295,7 @@ class Thumbnail: im = im.convert("RGB") im.save(self.thumbname, "JPEG") if filename.lower().endswith(".cr2"): if filename.lower().endswith((".cr2", ".cr3")): try: jpegname = f".thumbnails/{thumb_filename}.p.jpg" subprocess.run( Loading @@ -308,6 +309,18 @@ class Thumbnail: filename, ] ) # JpgFromRaw tends to have higher resolution, so overwrite PreviewImage if it is present subprocess.run( [ "exiftool", "-quiet", "-binary", "-tagOut!", jpegname, "-JpgFromRaw", filename, ] ) self.jpegname = jpegname except FileNotFoundError: pass Loading Loading @@ -760,9 +773,48 @@ if __name__ == "__main__": try: im = Image.open(f".thumbnail.for.{filename}") except FileNotFoundError: continue im = None except PIL.UnidentifiedImageError: # perhaps raise a warning? im = None if not im: try: _, jpegname = tempfile.mkstemp(suffix="jpg") subprocess.run( [ "exiftool", "-quiet", "-binary", "-tagOut!", jpegname, "-PreviewImage", filename, ] ) # JpgFromRaw tends to have higher resolution, so overwrite PreviewImage if it is present subprocess.run( [ "exiftool", "-quiet", "-binary", "-tagOut!", jpegname, "-JpgFromRaw", filename, ] ) im = Image.open(jpegname) os.remove(jpegname) except FileNotFoundError: im = None except PIL.UnidentifiedImageError: # perhaps raise a warning? os.remove(jpegname) im = None if not im: continue try: Loading Loading
bin/pyggle +55 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ from progress.bar import Bar import shutil import subprocess import sys import tempfile geocoder = None location_cache = dict() Loading Loading @@ -294,7 +295,7 @@ class Thumbnail: im = im.convert("RGB") im.save(self.thumbname, "JPEG") if filename.lower().endswith(".cr2"): if filename.lower().endswith((".cr2", ".cr3")): try: jpegname = f".thumbnails/{thumb_filename}.p.jpg" subprocess.run( Loading @@ -308,6 +309,18 @@ class Thumbnail: filename, ] ) # JpgFromRaw tends to have higher resolution, so overwrite PreviewImage if it is present subprocess.run( [ "exiftool", "-quiet", "-binary", "-tagOut!", jpegname, "-JpgFromRaw", filename, ] ) self.jpegname = jpegname except FileNotFoundError: pass Loading Loading @@ -760,9 +773,48 @@ if __name__ == "__main__": try: im = Image.open(f".thumbnail.for.{filename}") except FileNotFoundError: continue im = None except PIL.UnidentifiedImageError: # perhaps raise a warning? im = None if not im: try: _, jpegname = tempfile.mkstemp(suffix="jpg") subprocess.run( [ "exiftool", "-quiet", "-binary", "-tagOut!", jpegname, "-PreviewImage", filename, ] ) # JpgFromRaw tends to have higher resolution, so overwrite PreviewImage if it is present subprocess.run( [ "exiftool", "-quiet", "-binary", "-tagOut!", jpegname, "-JpgFromRaw", filename, ] ) im = Image.open(jpegname) os.remove(jpegname) except FileNotFoundError: im = None except PIL.UnidentifiedImageError: # perhaps raise a warning? os.remove(jpegname) im = None if not im: continue try: Loading