Scale images to integer heights
This commit is contained in:
parent
9e6ee2c499
commit
c727bdf91e
@ -12,7 +12,7 @@ extension NSSize {
|
|||||||
return self
|
return self
|
||||||
}
|
}
|
||||||
|
|
||||||
let height = height * desiredWidth / width
|
let height = (height * desiredWidth / width).rounded(.down)
|
||||||
return NSSize(width: desiredWidth, height: height)
|
return NSSize(width: desiredWidth, height: height)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ final class FileSystem {
|
|||||||
let scaledImage = sourceImage.scaledDown(to: destinationSize)
|
let scaledImage = sourceImage.scaledDown(to: destinationSize)
|
||||||
let scaledSize = scaledImage.size
|
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)
|
log.add(warning: "Desired width \(desiredWidth), got \(scaledSize.width)", source: destination)
|
||||||
}
|
}
|
||||||
if abs(destinationSize.height - scaledImage.size.height) > 2 {
|
if abs(destinationSize.height - scaledImage.size.height) > 2 {
|
||||||
|
Loading…
Reference in New Issue
Block a user