Scale images to integer heights

This commit is contained in:
Christoph Hagen 2022-09-16 15:32:55 +02:00
parent 9e6ee2c499
commit c727bdf91e
2 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@ extension NSSize {
return self
}
let height = height * desiredWidth / width
let height = (height * desiredWidth / width).rounded(.down)
return NSSize(width: desiredWidth, height: height)
}
}

View File

@ -316,7 +316,7 @@ final class FileSystem {
let scaledImage = sourceImage.scaledDown(to: destinationSize)
let scaledSize = scaledImage.size
if abs(scaledImage.size.width - desiredWidth) > 2 {
if abs(scaledSize.width - desiredWidth) > 2 {
log.add(warning: "Desired width \(desiredWidth), got \(scaledSize.width)", source: destination)
}
if abs(destinationSize.height - scaledImage.size.height) > 2 {