Clipping path doesn't follows the images size

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Clipping path doesn't follows the images size

Post by eduardo.melgar »

Original file (cmyk_8bits_path.tif):https://docs.google.com/file/d/0B8WNVy3 ... edit?pli=1
Result file (test.tif):https://docs.google.com/file/d/0B8WNVy3 ... sp=sharing
Photoshop Screenshot (photoshop_screenshot.pdf):https://docs.google.com/file/d/0B8WNVy3 ... sp=sharing

The command I run is:
convert cmyk_8bits_path.tif -flatten -alpha transparent -clip -alpha opaque -trim +repage test.tif
What I am trying to do here is:
- Flatten the image to get only one layer (-flatten)
- Get rid of the background (-alpha transparent -clip -alpha opaque)
- Trim the page based on transparent pixels (-trim +repage)
As you can see the clipping-path is around the original product image (file: cmyk_8bits_path.tif) and after running the commands the image is transparent and is trimmed but the path size is different: it looks like the size is reduced together with the size of the canvas (I am not changing the image size, only the canvas size when trimming)

I run IM on a Ubuntu 13.04 box with the default IM installation:
Version: ImageMagick 6.7.7-10 2013-09-10 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Last edited by eduardo.melgar on 2013-09-24T13:51:53-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Clipping path doesn't follows the images size

Post by snibgo »

It is good practice to turn off clipping when you have finished with it.

Code: Select all

convert cmyk_8bits_path.tif -flatten -alpha transparent -clip -alpha opaque +clip -trim +repage test.tif
However, this doesn't solve the problem. By a process of elimination, there seems to be a bug that "-trim" shrinks the path, as if it was resized. We can see where the path is by:

Code: Select all

%IM%convert test.tif -clip -negate +clip t.tif
A simpler command also shrinks the clip path, but not so much:

Code: Select all

%IM%convert cmyk_8bits_path.tif -trim test2.tif
(Tested with 6.8.6-9 in Windows 7.)

Perhaps my understanding of "-trim" and clip paths is wrong, or a developer would need to comment.
snibgo's IM pages: im.snibgo.com
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Re: Clipping path doesn't follows the images size

Post by eduardo.melgar »

Hi,
Anybody knows how to get this issue reviewed by a developer?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Clipping path doesn't follows the images size

Post by dlemstra »

Can you fix the link to your "Result file (test.tif)" image? Its the same file as the original file.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
eduardo.melgar
Posts: 15
Joined: 2013-08-21T05:08:29-07:00
Authentication code: 6789

Re: Clipping path doesn't follows the images size

Post by eduardo.melgar »

Sorry about the link. It is fixed now.
Post Reply