Newer
Older
package mediamdl
// ffmpeg -i input.jpg -vf scale=320:240 output_320x240.png
// ffmpeg -i test.tif -vf scale=504:376 -sws_flags bilinear out.bmp
// ffmpeg -i input.jpg -vf scale=iw*2:ih input_double_width.png
// CompressImage - CompressImage
func compressImage(inputPath, outputfilePath string) error {
commandargs := []string{`-i`, inputPath, `-vf`, `scale=iw:-1`, `-y`, outputfilePath}
return executeargs("ffmpeg", commandargs)
}
// ResizeImage - ResizeImage
func resizeImage(inputPath, outputfilePath, targetwidth string) error {
commandargs := []string{`-i`, inputPath, `-vf`, `scale=` + targetwidth + `:-1`, `-y`, outputfilePath}
return executeargs("ffmpeg", commandargs)
}
// resizeImageWithoutAspectRatio - resizeImageWithoutAspectRatio
func resizeImageWithoutAspectRatio(inputPath, outputfilePath, targetwidth, targetheight string) error {
commandargs := []string{`-i`, inputPath, `-vf`, `scale=` + targetwidth + `:` + targetheight, `-y`, outputfilePath}
return executeargs("ffmpeg", commandargs)
}
// SmartCropImage - SmartCropImage
func smartCropImage() error {
return executeargs("", []string{})
}