支持圖片類型:bmp、tiff、jpg、jpeg、gif、png、webp支持類型轉換為:bmp、tiff、jpg、jpeg、gif、png支持自定義寬度、高度五種等比縮放模式使用方法
ImgResizer -source {source} -dest {dest} -mode {mode} -dest stringDestination file or directory. -format string Ouput format. Supported values: png|jpg|jpeg|bmp|tiff|gif. Omit to keep original format. -height int Destination height. Omit to keep original height (default -1)
-help Show help message. -mode int 0 - (Default) Nearest-neighbor interpolation 1 - Bilinear interpolation
2 - Bicubic interpolation 3 - Mitchell-Netravali interpolation 4 - Lanczos resampling with a=2 5 - Lanczos resampling with a=3 -source string
Source file or directory. -width int Destination width. Omit to keep original width (default -1)
注意事項如果不需要改變原圖類型批量圖片格式轉換工具批量圖片格式轉換工具,請省略 - 參數webp 格式圖片,默認轉換為 png 格式處理(目前沒有 webp 圖片的高效、簡潔處理辦法)如果不需要改變原圖尺寸,請同時省略 -width 和 - 參數使用示例1. 批量等比縮放
ImgResizer -source ~/pics -dest ~/new_pics -mode 5 -height 128 -width 300
2. 單文件指定寬度
ImgResizer -source ~/pics/hello.gif -dest ~/newpics/wow.gif -width 900
3. 批量類型轉換
ImgResizer -source ~/pics -dest ~/new_pics -format jpg
源代碼Gitee