80d3c08a93
- Move to global objects for files and validation - Only write changed files - Check images for changes before scaling - Simplify code
16 lines
347 B
Swift
16 lines
347 B
Swift
import Foundation
|
|
import AppKit
|
|
|
|
extension NSImage {
|
|
|
|
func scaledDown(to size: NSSize) -> NSImage {
|
|
guard self.size.width > size.width else {
|
|
return self
|
|
}
|
|
return NSImage(size: size, flipped: false) { (resizedRect) -> Bool in
|
|
self.draw(in: resizedRect)
|
|
return true
|
|
}
|
|
}
|
|
}
|