Use ImageMagick to create CMYK image in PHP

The PHP code is below, but the CMYK color of image was channged in photoshop. NEED HELP!
$fg was channged to cmyk(61,61,61,0),
$bg was correct, but display as white,
$lg was channged to cmyk(0,99,99,0).

The created image is below:
cmyk