Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if fformat.lower() in ('tif', 'tiff'):
kwargs = kwargs or {}
kwargs['writer_options'] = writer_options
return self.geotiff_save(filename, compression, tags,
gdal_options, blocksize,
**kwargs)
try:
# Let image.pil_save it ?
Image.save(self, filename, compression, fformat=fformat)
except UnknownImageFormat:
# No ... last resort, try to import an external module.
logger.info("Importing image writer module '%s'" % fformat)
try:
saver = __import__(fformat, globals(), locals(), ['save'])
except ImportError:
raise UnknownImageFormat(
"Unknown image format '%s'" % fformat)
kwargs = kwargs or {}
kwargs['writer_options'] = writer_options
saver.save(self, filename, **kwargs)
file_tuple = os.path.splitext(filename)
fformat = fformat or file_tuple[1][1:]
if fformat.lower() in ('tif', 'tiff'):
return self.geotiff_save(filename, compression, tags,
gdal_options, blocksize, **kwargs)
try:
# Let image.pil_save it ?
Image.save(self, filename, compression, fformat=fformat)
except UnknownImageFormat:
# No ... last resort, try to import an external module.
logger.info("Importing image writer module '%s'" % fformat)
try:
saver = __import__(fformat, globals(), locals(), ['save'])
except ImportError:
raise UnknownImageFormat(
"Unknown image format '%s'" % fformat)
saver.save(self, filename, **kwargs)