It is a Hexo plug-in for generating thumbnails etc. using ImageMagick.
Since you can freely set arguments, you can generate various kinds of images as well as thumbnails.
- ImageMagick
npm install hexo-filter-variant-images --save
# variant images
variant_images:
cmd: 'magick'
match: '**/*.{jpg,gif,png}'
match_options:
debug: true
exclude: 'static/**/*'
priority: 5
items:
- suffix: '@preview'
extension: 'gif'
size: '20x20'
blur: '1.5'
posterize: '16'
args: '-resize $size -blur $blur -posterize $posterize'
- suffix: '@small'
size: '120x120'
args: '-resize $size'
Run command. The default value is magick
.
Also I am only checking the operation with magick
.
Specify the path of the target image file with glob.
The default value is **/*.{jpg,gif,png}
Option for minimatch. The default value is empty.
For details Minimatch#options
Specify the path of the file to be excluded with glob. The default value is empty.
Specify the priority of the filter by numerical value. The default value is 5
.
For details Filter | Hexo
Variations to generate. Required items are suffix, args
Suffix of the generated image.
Extension of the generated image. If unspecified, it will have the same extension as the original image.
Arguments to pass to the command. If you write it like $size
, you can refer to the settings in the same item.
items:
- suffix: '@preview'
extension: 'gif'
size: '20x20'
blur: '1.5'
posterize: '16'
args: '-resize $size -blur $blur -posterize $posterize'
- suffix: '@small'
args: '-resize 120x120'