Skip to content

Commit

Permalink
fix addalpha with scrgb images
Browse files Browse the repository at this point in the history
  • Loading branch information
jcupitt committed Mar 7, 2024
1 parent 3eff2c7 commit 3c92762
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- improve generation of `enums.py`
- add `stream.py` example
- fix a missing reference issue with custom sources
- fix `addalpha` with scrgb images [RiskoZoSlovenska]

## Version 2.2.2 (released 4 Jan 2023)

Expand Down
2 changes: 2 additions & 0 deletions pyvips/vimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1886,6 +1886,8 @@ def addalpha(self):
"""Add an alpha channel."""
if self.interpretation == 'grey16' or self.interpretation == 'rgb16':
max_alpha = 65535
elif self.interpretation == 'scrgb':
max_alpha = 1.0
else:
max_alpha = 255
return self.bandjoin(max_alpha)
Expand Down

0 comments on commit 3c92762

Please sign in to comment.