The error is on this line
Image img = new Image(stream);
The problem might be that Stream stream = a.GetManifestResourceStream("name.png");
doesn't know how to convert a png to a stream.
Keep in mind I don't know what I'm talking about, just guessing.