I am using the following code in Go to resize my images in JPEG and PNG format. So, how do I convert them to progressive and optimized using Imagick. I'm using ImageMagick 6.9.3-8 Q16 x86_64
on ubuntu 14.04
I am saying optimized reason being I used the following command to test whether image size gets reduced or not. But, it increases the output file size.
Command :
convert -strip -interlace Plane input-file.jpg output-file.jpg
Go code :
size = fmt.Sprintf("%dx%d^+0+0", w, h)
tx := mw.TransformImage("", size)
tx.SetImageGravity(imagick.GRAVITY_CENTER)
offsetX := -(int(w) - int(tx.GetImageWidth())) / 2
offsetY := -(int(h) - int(tx.GetImageHeight())) / 2
err := tx.ExtentImage(w, h, offsetX, offsetY)