Skip to content

Commit

Permalink
Merge pull request #1016 from girder/vips-float32-output
Browse files Browse the repository at this point in the history
Better output new vips images as float32.
  • Loading branch information
manthey authored Dec 20, 2022
2 parents 86d9616 + 63d799e commit ec5fe34
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 ec5fe34

Please sign in to comment.