goresize

command module
v0.0.0-...-45f3761 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2022 License: MIT Imports: 9 Imported by: 0

README

GoResize

Goresize is a small and simple script to resize all images inside a folder, including subfolders.

Usage

You can set the desired width and height as well as the quality using the following arguments:

Flag Type Default Explanation
-d string . Directory where to resize images
-w int 1224 Desired image width, in pixels. Setting it to 0 will keep the ratio.
-h int 0 Desired image height, in pixels. Setting it to 0 will keep the ratio.
-q int 80 Desired image quality, from 0 to 100 (lower to better)
// This will resize all images inside mydir to 400x400px and save them with a quality of 70
$ goresize -d=mydir -w=400 -h=400 q=90

// This will resize all images inside mydir to a width of 400px maintaining the original ratio and save them with a quality of 90
$ goresize -d=mydir -w=400 q=70

Image quality

Image quality argumentw will be applied only to images of type JPG or PNG.

For JPG images, the indicated ratio will be applied.

For JPG images, the ratio will be converted to the PNG compression level of the image/png Go package, as follows:

100 NoCompression
80 - 99 DefaultCompression
60 - 79 BestSpeed
0 - 60 BestCompression

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

Based on the package Imaging

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL