投稿のテスト中
package main
import (
"fmt"
"image"
"image/jpeg"
"log"
"os"
"path/filepath"
"github.com/nfnt/resize"
)
func onError(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
var (
rw, rh uint
)
if len(os.Args) < 2 {
log.Fatal("Not File")
}
//Get image size
file, err := os.Open(os.Args[1])
_, inFileName := filepath.Split(file.Name())
fmt.Printf(inFileName)
onError(err)
imgf, _, err := image.DecodeConfig(file)
file.Close()
w := imgf.Width
h := imgf.Height
fmt.Printf("Width=%d Height=%d", w, h)
- package main
- import (
- "fmt"
- "image"
- "image/jpeg"
- "log"
- "os"
- "path/filepath"
- "github.com/nfnt/resize"
- )
- func onError(err error) {
- if err != nil {
- log.Fatal(err)
- }
- }
- func main() {
- var (
- rw, rh uint
- )
- if len(os.Args) < 2 {
- log.Fatal("Not File")
- }
- //Get image size
- file, err := os.Open(os.Args[1])
- _, inFileName := filepath.Split(file.Name())
- fmt.Printf(inFileName)
- onError(err)
- imgf, _, err := image.DecodeConfig(file)
- file.Close()
- w := imgf.Width
- h := imgf.Height
- fmt.Printf("Width=%d Height=%d", w, h)
package main
import (
"fmt"
"image"
"image/jpeg"
"log"
"os"
"path/filepath"
"github.com/nfnt/resize"
)
func onError(err error) {
if err != nil {
log.Fatal(err)
}
}
func main() {
var (
rw, rh uint
)
if len(os.Args) < 2 {
log.Fatal("Not File")
}
//Get image size
file, err := os.Open(os.Args[1])
_, inFileName := filepath.Split(file.Name())
fmt.Printf(inFileName)
onError(err)
imgf, _, err := image.DecodeConfig(file)
file.Close()
w := imgf.Width
h := imgf.Height
fmt.Printf("Width=%d Height=%d", w, h)
ソースコードはどうかな・・・
写真