I need to convert .tif files containing a clipping path to .png while applying some additional conversions:
- apply the clipping path and make the background (everything outside the clipping path) transparent
- crop/trim the image so its width and height equal the remaining content (everything that's inside the clipping path)
- resize to a certain fixed width/height without distorting the image
- create a soft drop shadow to the content inside the clipping path
- add a transparent border of 10% of the resulting width/height
- convert to .png
I found a way to do all this (except the reduction of the file size) on the command line by concatenating two "convert" commands. However, in my specific case IM is used as a conversion tool by a separate application, and I need to find a way to execute the steps described above in one single command line.
My concatenated command looks like this:
Code: Select all
convert source.tif -clip -alpha set -background transparent -trim -delete 1-5 -resize 850x1136 miff:- | convert - \( +clone -background black -shadow 20x10+0+50 \) +swap -background none -layers merge -border 10% target.png
And here is the link to a sample .png file, as I would like it to be generated: https://www.dropbox.com/s/9ywwo8zgoczkvh9/salad.png
Any ideas will be greatly appreciated.