I have a image file stored in the resource folder.I am opening it and I am able to get its size but when I am printing it in string using string(size) it is showing special character(a square).I checked its type using reflect.Typeof(),it is giving int64.How to convert this to string and print the size as a string????
I am using the following code:
imgFile,_ := os.Open("QrImgGA.png")
fInfo, _ := imgFile.Stat()
var size int64 = fInfo.Size()
fmt.Println(string(size))//Prints the size correctl.Eg.,678899
But when I try to put it in json it shows some special character by doing the following:
m:=make(map[string]string)
m["bytes"]=string(size)
js,_:=json.Marshal(m)
fmt.Println(string(js))//Gives value as special character
Any suggestions?? or is there some another way of finding the size of an image???