Last active
August 29, 2015 14:26
-
-
Save yoya/22c62cca1d56af184864 to your computer and use it in GitHub Desktop.
GetImageProfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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