First time here? Check out the FAQ!
answered 2018-05-29 05:21:19 -0600
you need to call imwrite() with a filename and an extension (so it can infer the type), like this:
imwrite("my.png", img);