diff --git a/test/test_converter.py b/test/test_converter.py index eea1eceae..c77584329 100644 --- a/test/test_converter.py +++ b/test/test_converter.py @@ -68,6 +68,9 @@ def testIsVips(): ({'compression': 'lzw', 'predictor': 'yes'}, { tifftools.Tag.Compression.value: tifftools.constants.Compression.LZW.value }), + ({'compression': 'webp', 'quality': 0}, { + tifftools.Tag.Compression.value: tifftools.constants.Compression.WEBP.value + }), ({'tileSize': 512}, { tifftools.Tag.TileWidth.value: 512 }), diff --git a/utilities/converter/large_image_converter/__init__.py b/utilities/converter/large_image_converter/__init__.py index 4f1e4f652..29bdca1e7 100644 --- a/utilities/converter/large_image_converter/__init__.py +++ b/utilities/converter/large_image_converter/__init__.py @@ -559,6 +559,8 @@ def _vips_parameters(forTiled=True, **kwargs): convertParams[vkey] = kwargs[kwkey] if convertParams['compression'] == 'jp2k': convertParams['compression'] = 'none' + if convertParams['compression'] == 'webp' and kwargs.get('quality') == 0: + convertParams['lossless'] = True if convertParams['predictor'] == 'yes': convertParams['predictor'] = 'horizontal' if convertParams['compression'] == 'jpeg': diff --git a/utilities/converter/large_image_converter/__main__.py b/utilities/converter/large_image_converter/__main__.py index 10e0947fa..86d37f1f3 100644 --- a/utilities/converter/large_image_converter/__main__.py +++ b/utilities/converter/large_image_converter/__main__.py @@ -34,7 +34,8 @@ def get_parser(): 'compression ratio.') parser.add_argument( '--quality', '-q', default=90, type=int, - help='JPEG compression quality') + help='JPEG or webp compression quality. For webp, specify 0 for ' + 'lossless.') parser.add_argument( '--level', '-l', type=int, help='General compression level. Used for deflate (zip), zstd, and '