diff --git a/pyimgproxy/image.py b/pyimgproxy/image.py index 761dc6a..78ff450 100644 --- a/pyimgproxy/image.py +++ b/pyimgproxy/image.py @@ -189,7 +189,7 @@ def dpr(self, dpr: int | float) -> "Image": """ return self.add_option("dpr", dpr) - def enlarge(self, enlarge: bool = False) -> "Image": + def enlarge(self, enlarge: bool = True) -> "Image": """ When set to `True`, imgproxy will enlarge the image if it is smaller than the given size. @@ -522,7 +522,7 @@ def watermark_shadow(self) -> "Image": def style(self) -> "Image": raise NotImplementedError - def strip_metadata(self, strip_metadata: bool = False) -> "Image": + def strip_metadata(self, strip_metadata: bool = True) -> "Image": """ When set to `True`, imgproxy will strip the metadata (EXIF, IPTC, etc.) on JPEG and WebP output images. This is normally controlled by the `IMGPROXY_STRIP_METADATA` configuration @@ -530,7 +530,7 @@ def strip_metadata(self, strip_metadata: bool = False) -> "Image": """ return self.add_option("strip_metadata", strip_metadata) - def keep_copyright(self, keep_copyright: bool = False) -> "Image": + def keep_copyright(self, keep_copyright: bool = True) -> "Image": """ When set to `True`, imgproxy will not remove copyright info while stripping metadata. This is normally controlled by the `IMGPROXY_KEEP_COPYRIGHT` configuration but this processing @@ -541,7 +541,7 @@ def keep_copyright(self, keep_copyright: bool = False) -> "Image": def dpi(self) -> "Image": raise NotImplementedError - def strip_color_profile(self, strip_color_profile: bool = False) -> "Image": + def strip_color_profile(self, strip_color_profile: bool = True) -> "Image": """ When set to `True`, imgproxy will transform the embedded color profile (ICC) to sRGB and remove it from the image. Otherwise, imgproxy will try to keep it as is. This is normally @@ -550,7 +550,7 @@ def strip_color_profile(self, strip_color_profile: bool = False) -> "Image": """ return self.add_option("strip_color_profile", strip_color_profile) - def enforce_thumbnail(self, enforce_thumbnail: bool = False) -> "Image": + def enforce_thumbnail(self, enforce_thumbnail: bool = True) -> "Image": """ When set to `True` and the source image has an embedded thumbnail, imgproxy will always use the embedded thumbnail instead of the main image. Currently, only thumbnails embedded diff --git a/tests/test_image.py b/tests/test_image.py index 8c88efa..52d5c4b 100644 --- a/tests/test_image.py +++ b/tests/test_image.py @@ -97,6 +97,11 @@ def test_enlarge(self): self.assertEqual(image.options, ["enlarge:True"]) + def test_enlarge_default(self): + image = self.image.enlarge() + + self.assertEqual(image.options, ["enlarge:True"]) + def test_extend(self): image = self.image.extend( extend=True, @@ -247,21 +252,41 @@ def test_strip_metadata(self): self.assertEqual(image.options, ["strip_metadata:True"]) + def test_strip_metadata_default(self): + image = self.image.strip_metadata() + + self.assertEqual(image.options, ["strip_metadata:True"]) + def test_keep_copyright(self): image = self.image.keep_copyright(keep_copyright=True) self.assertEqual(image.options, ["keep_copyright:True"]) + def test_keep_copyright_default(self): + image = self.image.keep_copyright() + + self.assertEqual(image.options, ["keep_copyright:True"]) + def test_strip_color_profile(self): image = self.image.strip_color_profile(strip_color_profile=True) self.assertEqual(image.options, ["strip_color_profile:True"]) + def test_strip_color_profile_default(self): + image = self.image.strip_color_profile() + + self.assertEqual(image.options, ["strip_color_profile:True"]) + def test_enforce_thumbnail(self): image = self.image.enforce_thumbnail(enforce_thumbnail=True) self.assertEqual(image.options, ["enforce_thumbnail:True"]) + def test_enforce_thumbnail_default(self): + image = self.image.enforce_thumbnail() + + self.assertEqual(image.options, ["enforce_thumbnail:True"]) + def test_quality(self): image = self.image.quality(quality=50)