Is the data encoded differently between browser and PhntomJS? And is the PhantomJS one actually valid image data?
A small example or the data strings from browser and PhantomJS would be helpful when trying to fix it. Ideally, as a bug report: http://code.google.com/p/phantomjs/issues