imagemagickphotoshopimage-clipping

To what extent can ImageMagick retain a clipping path when converting PSD files into GIF, PNG, JPG files?


We have a PHP tool which converts images from PSD into other formats by calling ImageMagick.

In order to potentially extend the tool's functionality, I now need to find out "what are the possibilities of ImageMagick to convert PSD files into GIF, PNG, and JPG files in respect to clipping paths", e.g. answering the following questions:


Solution

  • I do not have a psd file with a clip path - out of interest could you provide me with one I can use on my imagemagick example site? I have a jpg with a clip path but am not alowed to use it on my site.

    Anyway I started with a jpg that I am told has a clip path and ran this code:

    exec(" convert clip_path.jpg -clip -negate clipped1.jpg");
    exec(" convert clip_path.jpg -resize x300 -clip -negate clipped2.jpg");
    exec(" convert clip_path.jpg clipped3.png");
    exec(" convert clipped3.png -clip -negate clipped4.jpg");
    

    The results were:

    1/ Inverted colours within the clip path - so clip path is working.

    2/ Resized and inverted colours within the clip path - so clip path is retained on resize.

    3/ Changed to a png ready for the clip test in 4/

    4/ Inverted colours within the clip path - clip path is retaind when changing format.

    The clip options are listed here http://www.imagemagick.org/script/command-line-options.php#clip and some examples and more notes here http://www.imagemagick.org/Usage/masking/#clip_mask