Skip to content

Instantly share code, notes, and snippets.

@yoya
Last active August 29, 2015 14:26
Show Gist options
  • Save yoya/22c62cca1d56af184864 to your computer and use it in GitHub Desktop.
Save yoya/22c62cca1d56af184864 to your computer and use it in GitHub Desktop.
GetImageProfiles
package main
import (
"flag"
"fmt"
"github.com/gographics/imagick/imagick"
"os"
)
func main() {
flag.Parse()
imagick.Initialize()
defer imagick.Terminate()
mw := imagick.NewMagickWand()
defer mw.Destroy()
var err error
if flag.NArg() < 1 {
fmt.Println("Usage: imagick_profiles <imgfile> [<proftype>]\n")
os.Exit(1)
}
imgfile := flag.Arg(0)
err = mw.ReadImage(imgfile)
if err != nil {
fmt.Println("ReadImage Error:", imgfile, err)
os.Exit(1)
}
if flag.NArg() == 1 {
profs := mw.GetImageProfiles("*")
fmt.Println(profs)
} else {
proftype := flag.Arg(1)
prof := mw.GetImageProfile(proftype)
fmt.Print(prof)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment