Coverage for src/lektor_ng/imagetools/__init__.py: 100%

12 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-09-05 16:51 +0000

1from __future__ import annotations 

2 

3from pathlib import Path 

4 

5from ..utils import deprecated 

6from .exif import read_exif 

7from .image_info import get_image_info 

8from .thumbnail import ( 

9 Thumbnail, 

10 ThumbnailMode, 

11 compute_dimensions, 

12 make_image_thumbnail, 

13) 

14 

15__all__ = [ 

16 "Thumbnail", 

17 "ThumbnailMode", 

18 "compute_dimensions", 

19 "get_image_info", 

20 "get_quality", 

21 "make_image_thumbnail", 

22 "read_exif", 

23] 

24 

25 

26@deprecated(version="3.4.0") 

27def get_quality(source_filename: str | Path) -> int: 

28 """Get the effective default thumbnail _quality_. 

29 

30 This is the ImageMagick "quality" that is used, by default, when generating 

31 thumbnails. 

32 

33 """ 

34 if get_image_info(source_filename).format == "png": 

35 return 75 

36 return 85