Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pyimgproxy/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -522,15 +522,15 @@ 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
but this processing option allows the configuration to be set for each request.
"""
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
Expand All @@ -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
Expand All @@ -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
Expand Down
25 changes: 25 additions & 0 deletions tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)

Expand Down