You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
481 B
30 lines
481 B
package main
|
|
|
|
import (
|
|
"dsSupport/Utils/ImageUtil"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
//源图片
|
|
src := "g:/IMG_20200512_114233.jpg"
|
|
//目标图片名称
|
|
dst := strings.Replace(src, ".", "_small.", 1)
|
|
fmt.Println("src=", src, " dst=", dst)
|
|
|
|
//打开源文件
|
|
fIn, _ := os.Open(src)
|
|
defer fIn.Close()
|
|
//创建目标文件
|
|
fOut, _ := os.Create(dst)
|
|
defer fOut.Close()
|
|
|
|
//缩放
|
|
err := ImageUtil.Scale(fIn, fOut, 800, 600, 100)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
}
|