Swiftpack.co - nashysolutions/Vice as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by nashysolutions.
nashysolutions/Vice 2.1.0
A library / executable for resizing png images.
⭐️ 0
🕓 35 weeks ago
iOS macOS
.package(url: "https://github.com/nashysolutions/Vice.git", from: "2.1.0")


A command line tool for resizing png images. The underlying API is also available, should you want to include it in your development projects.


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

Man Page

USAGE: vice <file> <width> <height> [--ratio]

  <file>                  A local image file. 
  <width>                 The target width of the image. 
  <height>                The target height of the image. 

  -r, --ratio             Maintain aspect ratio 
  -h, --help              Show help information.

Jaws API

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 = Size(width: width, height: height)
let jaws = Jaws(file: file, targetSize: targetSize, maintainRatio: false)
try jaws.resize()


Install Swift.

Vice Command Line Tool

$ git clone https://github.com/nashysolutions/Vice.git
$ cd Vice
$ swift build -c release
$ cd .build/release
$ cp -f vice /usr/local/bin/vice

If you have any issues with unix directories this article might be helpful.

Jaws Library

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: [
            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.


Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Vice 2.1.0
35 weeks ago

Now supports iOS.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics