On my website I use a small image upload script. It generates thumbnails and pictures for es-commerce. However, recently I've noticed that some images kinda 'loose color'.
Sample can be observed with this picture of a red sofa here:

Converted image on the left, original - on the right.
I do think it's something to do with colorspaces probably. My code is very simple and looks like this (I'll skip some code and leave only Imagick parts):
$image = new Imagick($picfile);
Imagick::setResourceLimit (6, 1);
$image->resizeImage($maxwidth,0,Imagick::FILTER_LANCZOS,1);
$image->cropThumbnailImage($maxwidth, $maxheight);
$image->writeImage($path);
$image->destroy();
I probably need to add up some line in the beginning to convert this to srgb or something. Can someone point me out to what should be added? Thanks!