Skip to content

Commit

Permalink
Better output new vips images as float32.
Browse files Browse the repository at this point in the history
When asking to output vips images as float32, they were being promoted
to float64.
  • Loading branch information
manthey committed Dec 20, 2022
1 parent 86d9616 commit 63d799e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
### Changes
- Don't report filename in internal PIL metadata ([#1006](../../pull/1006))

### Bug Fixes
- Better output new vips images as float32 ([#1016](../../pull/1016))

## 1.18.0

### Features
Expand Down
5 changes: 4 additions & 1 deletion sources/vips/large_image_source_vips/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,11 @@ def _outputToImage(self):
trunk = baseimg.copy()
branch = baseimg.copy()
for idx, entry in enumerate(self._output['images']):
entryimage = entry['image']
if img.format == 'float' and entry['image'].format == 'double':
entryimage = entryimage.cast(img.format)
branch = branch.composite(
entry['image'], pyvips.BlendMode.OVER, x=entry['x'], y=entry['y'])
entryimage, pyvips.BlendMode.OVER, x=entry['x'], y=entry['y'])
if not ((idx + 1) % leaves) or idx + 1 == len(self._output['images']):
trunk = trunk.composite(branch, pyvips.BlendMode.OVER, x=0, y=0)
branch = baseimg.copy()
Expand Down

0 comments on commit 63d799e

Please sign in to comment.