To resize to 100 width x 200 height.
$ vice ~/Desktop/Filename.png 100 200
To maintain aspect ratio
$ vice -r ~/Desktop/Filename.png 100 9999
See man page for more details.
The underlying core library is also available as a product (see installation below).
import Files // github.com:JohnSundell/Files
import Jaws
let file = try File(path: "~/myfile.png")
let targetSize = CGSize(width: width, height: height)
let jaws = Jaws(file: file, targetSize: targetSize, maintainRatio: false)
try await jaws.resize()
$ git clone https://github.com/nashysolutions/Vice.git
$ cd Vice
$ swift run task install
If you have any issues with unix directories this article might be helpful.
let package = Package(
name: "MyTool",
products: [
.executable(name: "tool", targets: ["MyTool"]),
],
dependencies: [
.package(name: "Vice", url: "https://github.com/nashysolutions/Vice.git", .upToNextMinor(from: "2.0.0"))
],
targets: [
.target(
name: "MyTool",
dependencies: [
.product(name: "Jaws", package: "Vice")
])
]
)
Swift 5.3 only knows how to skip dependencies not used by any product, which in this package is none. This is a limitation at the moment with the Swift package manager.
As a result, if you mark your target as depending on the Jaws
product, Swift will download all the source for all the dependencies in this package.
Further, the entire Vice
package will be downloaded so that files such as the README and other such documentation is available.
That being said, only the source required for Jaws
will be compiled.
See thread on Swift forum.
link |
Stars: 0 |
Last commit: 1 year ago |
Introduces a breaking change - the resize
function is now mutating.
The original image is now available at the public interface.
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics