3

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:

  • can ImageMagick convert PSD files into GIF/JPG/PNG and maintain the clipping path so that it can be further edited later?

  • or can ImageMagick only convert PSD files into GIF/JPG/PNG and therefore converting everything outside the clipping path into a transparent area?

  • do each of the formats GIF, PNG, and JPG even support clipping paths in the sense that PSD files support them?

2
  • Did you notice bonzo's answer at all? Did it not help you with your problem? Jul 12, 2012 at 12:04
  • You're strange animal... Asking (good) questions here, but then not react to (good) answers or (any) comments. Aug 20, 2012 at 9:54

1 Answer 1

6

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

2
  • Not even a comment to my post - I give up with this site.
    – Bonzo
    Jun 29, 2012 at 20:39
  • You're a true ImageMagician! I only started to follow your answers here today -- but I found a few true gems already. Please don't give up! :-) Jul 12, 2012 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.