I'm reading a pgm-file in order to apply some filter to it and rewrite the result to a new pgm-file. However, I always end up with a binary file (vim doesn't show the values but stuff like ^G ^0 ^K etc, the file-command tells me it's a data file and imagemagick can't open the file)
The code where I write to the file looks like this:
fd,err := os.Create(filename)
wr := bufio.NewWriter(fd)
//img is of type [][]int and holds the values to be written
str := "P2
" + filename + "
" + string(len(img[0])) + ...
if _,err := wr.WriteString(outStr); err != nil {..}
and then some more of that in a loop where I go through the img array.
What am I missing here?