If you are working on psd files the layer containing all the layers will be [0].
Also if your Imagemagick version is greater than 6 you need to read the image in first:
Code: Select all
exec (" convert '$pixas2' -flatten -colorspace rgb -quality 60 -antialias -geometry {$maz_width2}x{$maz_height2} '$_aaa1'");