Mercurial > repos > shellac > guppy_basecaller
diff env/lib/python3.7/site-packages/galaxy/util/image_util.py @ 5:9b1c78e6ba9c draft default tip
"planemo upload commit 6c0a8142489327ece472c84e558c47da711a9142"
author | shellac |
---|---|
date | Mon, 01 Jun 2020 08:59:25 -0400 |
parents | 79f47841a781 |
children |
line wrap: on
line diff
--- a/env/lib/python3.7/site-packages/galaxy/util/image_util.py Thu May 14 16:47:39 2020 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -"""Provides utilities for working with image files.""" -from __future__ import absolute_import - -import imghdr -import logging - -try: - import Image as PIL -except ImportError: - try: - from PIL import Image as PIL - except ImportError: - PIL = None - -log = logging.getLogger(__name__) - - -def image_type(filename): - fmt = None - if PIL is not None: - try: - im = PIL.open(filename) - fmt = im.format - im.close() - except Exception: - # We continue to try with imghdr, so this is a rare case of an - # exception we expect to happen frequently, so we're not logging - pass - if not fmt: - fmt = imghdr.what(filename) - if fmt: - return fmt.upper() - else: - return False - - -def check_image_type(filename, types): - fmt = image_type(filename) - if fmt in types: - return True - return False