RMagick PNG issue

Hello all, I have a small routine to upload images from a browser and save them on the server utilising RMagick (v1.15.3). Things are working well as long as the image format is JPG, if I try using a PNG image it barfs with a NoMethoError for the resize_to_fit! method.

The error is:   You have a nil object when you didn't expect it!   The error occurred while evaluating nil.resize_to_fit!

Here's a snippet of the code         strimg = Base64.encode64(picture.read)         img = Magick::Image::read_inline(strimg).first         img.resize_to_fit! 640, 480

Any ideas?