jpeg
This commit is contained in:
parent
9a21ef6a3d
commit
3225640d7d
|
@ -5,7 +5,7 @@ import (
|
|||
"fmt"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/png"
|
||||
"image/jpeg"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -73,12 +73,12 @@ func corpImage(img image.Image, width int, level int, dirname string) {
|
|||
rect := image.Rect(i, j, i+1000, j+1000)
|
||||
imgOut := img.SubImage(rect)
|
||||
imgOut = imaging.Paste(imaging.New(1000, 1000, color.NRGBA{0, 0, 0, 0}), imgOut, image.Pt(0, 0))
|
||||
fileName := fmt.Sprintf("%s/%d/x%d_y%d.png", dirname, level, i/1000, j/1000)
|
||||
fileName := fmt.Sprintf("%s/%d/x%d_y%d.jpg", dirname, level, i/1000, j/1000)
|
||||
fileOut, err := os.Create(fileName)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
png.Encode(fileOut, imgOut)
|
||||
jpeg.Encode(fileOut, imgOut, &jpeg.Options{})
|
||||
fileOut.Close()
|
||||
wg.Done()
|
||||
}(&wg, i, j, img)
|
||||
|
|
Loading…
Reference in New Issue