If profileImage() seems to be doing nothing — and "inverted colors" during a CMYK > RGB conversion is a sign of this — check that ImageMagick has the lcms delegate available.
From a command prompt:
convert -list configure | grep DELEGATES
If you don't see lcms in the list then Imagick won't do any color profile conversions, and won't give any warnings about this. In that case, install the Little CMS library ( http://www.littlecms.com/ ) and recompile ImageMagick.