first working version
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func OptimizeImage(path string) {
|
||||
|
||||
fmt.Println("optiimg")
|
||||
cmd := exec.Command("mogrify",
|
||||
"-strip",
|
||||
"-interlace", "Plane",
|
||||
"-sampling-factor", "4:2:0",
|
||||
"-resize", "5000x3000",
|
||||
"-quality", "80%",
|
||||
path,
|
||||
)
|
||||
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
fmt.Printf("Error optimizing %s: %v\n%s", path, err, out)
|
||||
} else {
|
||||
markTouched(path)
|
||||
fmt.Printf("Optimized %s\n", path)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user