Anti-aliased clipping path

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?".
Locked
jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Anti-aliased clipping path

Post by jansuhr »

I'm working on a project that will receive hundreds of images with a clipping path. Each image will be saved in one version as a JPG with a white background and as a PSD with transparent background.

When using IM to clip the image I get a very jagged result where the clipping path is, very much like when you not using anti-aliased in Photoshop.

I haven't found any option to "-clip" with an anti-aliased option and after some searching I found a workaround that blurs the mask created from the -clip option. However the result doing this approach is not satisfying, you still see the jagginess but a little blurred.

The left one is made in IM the right one from Photoshop

Image


Is there anyway to get this better with IM?


Thanks

Jan

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Anti-aliased clipping path

Post by snibgo »

A better way is probably to extract the clip path as SVG, and rasterize that. See for example viewtopic.php?f=1&t=29674&p=133783
snibgo's IM pages: im.snibgo.com

jansuhr
Posts: 43
Joined: 2016-01-28T01:35:38-07:00
Authentication code: 1151

Re: Anti-aliased clipping path

Post by jansuhr »

I did as the example in the post and it got a little better but there is still more jaggines than with Photoshop.

This is the syntax I used

Code: Select all

identify -quiet -format "%[8BIM:1999,2998:#1]" input.jpg  | convert -quiet input.jpg ( - -negate ) -alpha off -compose copy_opacity -composite output.psd
There is a mention of +dither in one of the comments, where in the syntax should that be added?


Thanks


Jan

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Anti-aliased clipping path

Post by snibgo »

I can't see that "+dither" would have any effect.
snibgo's IM pages: im.snibgo.com

Locked