Insert 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?".
Post Reply
loic.rapp
Posts: 5
Joined: 2015-10-30T02:49:42-07:00
Authentication code: 1151

Insert clipping path

Post by loic.rapp » 2015-10-30T03:01:25-07:00

Hello,

Sorry, but I don't know exactly where I supposed to post my message. :D

I need to do something with ImageMagick: I have an empty image (JPEG) who contains an Photoshop clipping path.
With a

Code: Select all

identify -verbose $fileName
I can get the SVG clipping path code of my image (JPEG).

But now, I want to insert this clipping path into an other image (also a JPEG) who have no clipping path.
It is possible to do that with ImageMagick or not? If it's possible, how can I do that. I can show you an example if someone need it.

Have a good day!

User avatar
fmw42
Posts: 25123
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Insert clipping path

Post by fmw42 » 2015-10-30T13:56:23-07:00

IM can extract the clip path as an SVG (text) file. See http://www.imagemagick.org/Usage/masking/#clip_mask. But I do not think it can be transferred to another file. You can save the SVG clip path as an SVG file and then use it as a mask to apply to another file. See http://www.imagemagick.org/Usage/masking/#read_mask

loic.rapp
Posts: 5
Joined: 2015-10-30T02:49:42-07:00
Authentication code: 1151

Re: Insert clipping path

Post by loic.rapp » 2015-11-02T01:40:38-07:00

I already get an SVG clipping path, with a script who works with identify -verbose.

But, I don't really understand the read mask part..

User avatar
fmw42
Posts: 25123
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Insert clipping path

Post by fmw42 » 2015-11-02T11:06:21-07:00

I do not understand what exactly you are trying to do. Please explain in more detail. A clipping path from one image may not work for any other image. What do you want to do with the clipping path on the second image? Can you post your image that has the clipping path and the one you want to transfer it to and explain then how you want to use the clipping path on the second image? Is it to mask out some part of the second image?

loic.rapp
Posts: 5
Joined: 2015-10-30T02:49:42-07:00
Authentication code: 1151

Re: Insert clipping path

Post by loic.rapp » 2015-11-27T01:45:53-07:00

I need to extract a clipping path from one image (as SVG for example), and I need to reimport it to an other one.
So, I have a low quality JPEG file with a Photoshop Clipping Path, with a

Code: Select all

identify -verbose /path/of/myimage.jpg
I get the clipping path and I use "cut, grep and awk" to create a ready-to-use SVG file.
So for now, I have:
- One low quality JPEG
- One SVG file who is the low quality JPEG clipping path
- One high quality JPEG

How can I import the clipping path of the low quality JPEG to the high quality JPEG file? With the SVG or directly the low quality JPEG.

loic.rapp
Posts: 5
Joined: 2015-10-30T02:49:42-07:00
Authentication code: 1151

Re: Insert clipping path

Post by loic.rapp » 2015-12-07T02:40:40-07:00

UP!

loic.rapp
Posts: 5
Joined: 2015-10-30T02:49:42-07:00
Authentication code: 1151

Re: Insert clipping path

Post by loic.rapp » 2015-12-21T15:36:11-07:00

UP!

User avatar
fmw42
Posts: 25123
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Insert clipping path

Post by fmw42 » 2015-12-21T16:05:43-07:00

I am not an expert on clip paths. But I do not think IM can import clip paths from svg. As far as I know, it only exports clip paths.

Even if it could, the low res one would not work with the high res one. The clip path would not match on the high res one. You can apply the clip path as a mask, but I do not think it would match the high resolution image.

promonda
Posts: 3
Joined: 2019-06-14T05:14:26-07:00
Authentication code: 1152

Re: Insert clipping path

Post by promonda » 2019-06-14T14:37:43-07:00

I am using Magick.NET to process image in C#. I want to embed/add a clipping path taken from a SVG file to my target image. The clipping path dimension and target image dimension is exactly same. I want it to be embedded into target image so that we can change the background outside of clipping path.

There is two method for Clipping path functionality in Magick.NET GetClippingPath() and SetClippingPath(). While GetClippingPath() works well for images having clipping path embedded, SetClippingPath() doesn't work at all.

Is it really possible to set clip path using Magick.NET, if so how I can achieve this.. Please help. I have a deadline to answer if it can be done or not.

User avatar
fmw42
Posts: 25123
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Insert clipping path

Post by fmw42 » 2019-06-14T15:56:45-07:00

Code: Select all

I am not an expert on clip paths. But I do not think IM can import clip paths from svg. As far as I know, it only exports clip paths.

promonda
Posts: 3
Joined: 2019-06-14T05:14:26-07:00
Authentication code: 1152

Re: Insert clipping path

Post by promonda » 2019-06-18T07:49:47-07:00

Is it possible to add clipping path (from SVG) using ImageMagick command line or ImageMagick command also doesn't support it.

User avatar
fmw42
Posts: 25123
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Insert clipping path

Post by fmw42 » 2019-06-18T08:24:57-07:00

NO! ImageMagick cannot do that. Did you read the post above?

promonda
Posts: 3
Joined: 2019-06-14T05:14:26-07:00
Authentication code: 1152

Re: Insert clipping path

Post by promonda » 2019-06-18T08:42:49-07:00

Ok. I read the above post, just checked if there is any new version that support this as the earlier post is quite older. Thanks for your reply.

User avatar
fmw42
Posts: 25123
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Insert clipping path

Post by fmw42 » 2019-06-18T09:41:04-07:00

Sorry, no updates and no plans for that as far as I know.

Post Reply