How to remove a 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
YannCorno

How to remove a clipping path?

Post by YannCorno »

I have something really weird happening: after some complicated commands, involving composing, I end up with an image in the middle of a transparent background and I store this in a PNG file. Fine. Then I use a separate convert command, performing some cropping and extenting and produce a new PNG file. Everything works great so far.

Now here is the problem: if I put together both series of commands in the same 'convert' pipeline, I see some clipping occurring in the final image. :shock: So my theory is that there is some kind of clipping info that gets trashed when I am saving the first series into a PNG file, but that this clipping info is still active when I combine the two converts into one.

I looked at the -clip option, but did not find how to remove (or disable) a clipping path. How do you remove it?

Help!

Thanks in advance,

Yann
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: How to remove a clipping path?

Post by magick »

Add +repage to your command line to remove the virtual canvas. In case you are right about clipping, add -strip to your command line to remove any clipping paths / masks.
YannCorno

Re: How to remove a clipping path?

Post by YannCorno »

I knew about +repage, but did not know about -strip, this is good to know! Thanks!

After some more work, I finally found the origin of my problem: in the first part of the pipeline, that was a -gravity center command that had obviously an enduring side-effect all the way through. I was not aware that cropping and extending could be affected by gravity even if you specify the offset values.

Anyway, I inserted a -gravity none, and it fixed it. :)

I will keep as a rule of thumb that after doing operations using gravity (like rotation...), it is a good idea to turn it back off to avoid side effects.

Thanks again for the quick response!

Yann
Post Reply