Command that will work on images that has Clipping path and is Transparent

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
johnbasi
Posts: 14
Joined: 2017-12-08T02:45:45-07:00
Authentication code: 1152

Command that will work on images that has Clipping path and is Transparent

Post by johnbasi »

Hi guys,
Is there a command that works for both images that has Clipping path and Transparent images? I want to convert them to JPG file and make the background white.

This are the commands that I am using on each but would like to make a single command that works for both of them.
TRANSPARENT COMMAND

Code: Select all

convert INPUT.psd[1] -colorspace rgb -background white -flatten OUTPUT.jpg
CLIPPING PATH COMMAND

Code: Select all

convert INPUT.psd[0] -alpha transparent -clip -alpha opaque -background white -flatten OUTPUT.jpg
Files - one has clipping path the other is transparent
https://drive.google.com/file/d/1Lyiapo ... sp=sharing
https://drive.google.com/file/d/1ncdLIt ... sp=sharing

Version: ImageMagick 7.0.1-3 Q16 x64 2016-05-11
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Command that will work on images that has Clipping path and is Transparent

Post by snibgo »

"-clip" applies to all following operations, until "+clip". You don't have "+clip" in your second command. I suggest you insert one.

In your first command, the image already has transparency. In your second command, you create transparency from the clip path. These are two different operations, which is reasonable. But I don't see how you can "make a single [convert] command that works for both of them."
snibgo's IM pages: im.snibgo.com
Post Reply