Add more info in readme
A Publish plugin that helps running ImageMagick commands while building any Publish website.
To install it into your Publish package, add it as a dependency within your Package.swift manifest:
Package.swift
let package = Package( ... dependencies: [ ... .package(url: "https://github.com/mvolpato/magickpublishplugin", from: "0.3.0") ], targets: [ .target( ... dependencies: [ ... "MagickPublishPlugin" ] ) ] ... )
Then import SplashPublishPlugin wherever you’d like to use it:
import MagickPublishPlugin
For more information on how to use the Swift Package Manager, check out this article, or its official documentation.
You need ImageMagick version 6 to use the optimizeForWeb(imagesInFolder: String) method.
optimizeForWeb(imagesInFolder: String)
You can use other methods with version 7.
The plugin can then be used within any publishing pipeline like this:
import MagickPublishPlugin ... try DeliciousRecipes().publish(using: [ ... .installPlugin(.optimizeForWeb(imagesInFolder: "Output/assets/images/blog/")) ... ])
which will use a quite good image transformation by Dave Newton.
If you want more control over the transformation you can use, for instance,
import MagickPublishPlugin ... try DeliciousRecipes().publish(using: [ .installPlugin( ... .magick(arguments: [ "mogrify", "-thumbnail", "400", ], imagesFolder: "Output/assets/images/blog/") ) ... ])
You can also run the command on a single file:
import MagickPublishPlugin ... try DeliciousRecipes().publish(using: [ .installPlugin( ... .magick(arguments: [ "mogrify", "-thumbnail", "400", ], imageFile: "Output/assets/images/blog/my-cat-eating-a-burrito.jpg") ) ... ])
You probably want to run this step after .copyResources().
.copyResources()
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
ImageMagick plugin for Publish
A Publish plugin that helps running ImageMagick commands while building any Publish website.
Installation
To install it into your Publish package, add it as a dependency within your
Package.swift
manifest:Then import SplashPublishPlugin wherever you’d like to use it:
For more information on how to use the Swift Package Manager, check out this article, or its official documentation.
Usage
You need ImageMagick version 6 to use the
optimizeForWeb(imagesInFolder: String)
method.You can use other methods with version 7.
The plugin can then be used within any publishing pipeline like this:
which will use a quite good image transformation by Dave Newton.
If you want more control over the transformation you can use, for instance,
You can also run the command on a single file:
You probably want to run this step after
.copyResources()
.