This is a creation in Article, where the information may have evolved or changed.
Picture removal border (black edge, white edge)
Package Mainimport ("FMT" "Github.com/gographics/imagick/imagick" "Io/ioutil" "OS" "StrConv") func ReadFile (Pathstring) (string, error) {fi, err:=OS. Open (PATH)ifErr = =Nil {defer fi. Close () FD, err:=Ioutil. ReadAll (FI)return string(FD), err}Else { return "", err}} Func Main () {arg_num:=len (OS. Args)ifArg_num <3{fmt. Println ("./tester [Imagepath][trimdistance]") return} imagick. Initialize () defer imagick. Terminate () COMPMW:=Imagick. Newmagickwand () compmw.readimage (OS. args[1]) Trimdistance, _:= StrConv. parsefloat (OS. args[2],0) Err:=compmw.trimimage (trimdistance)ifErr! =Nil {fmt. Println ("Trim failed,", Err)} Else{compmw.trimimage (trimdistance) compmw.writeimage ("./trim.jpg") fmt. Println ("Trim Success")} Compmw.destroy ()}
=====================
Additional:
=====================
Do not understand, the code plus fuzz effect did not come out, command line can be carried out, is also drunk.
Convert ~/downloads/video1.jpg-fuzz 10%-trim./trim.jpg
Reference:
http://www.imagemagick.org/Usage/crop/#trim
http://blog.csdn.net/newborn2012/article/details/24964577