Crop Image to the Clip Mask isn't exact

Post Reply
bill_billings
Newbie
Posts: 6
Joined: Tue Apr 23, 2024 8:49 pm

Crop Image to the Clip Mask isn't exact

Post by bill_billings »

Hello,


When I run the "Crop Image to the Clip Mask" it doesn't crop the image to the clipping box but leaves a little "overhang" of the image that's being clipped off.

I use these settings:

crop image to clip mask.png
crop image to clip mask.png (65.13 KiB) Viewed 8900 times


Here's what it looks like if I flip to the wireframe view:

Image-Box-Frame1.gif
Image-Box-Frame1.gif (52.66 KiB) Viewed 8900 times


Where I run into a problem is that I then take this Image + Mask and use the "Move Objects to Corner" action to pin to an Art Box. The objects pin to the "Extra Image" that I clipped off, instead of pinning to the Mask. So I get a gap, the distance is the extra clipped image.

Here's what it looks like:

flush-art-box.gif
flush-art-box.gif (20.15 KiB) Viewed 8900 times



Is there a way to clip the image to the exact dimensions of the Clipping Mask? Or do I have to compensate for it when I use the "Move Objects to Corner" with some offset value?


Thanks!

--Bill
freddyp
Advanced member
Posts: 1129
Joined: Thu Feb 09, 2012 3:53 pm

Re: Crop Image to the Clip Mask isn't exact

Post by freddyp »

A property of images is that all pixels have the same size depending on the resolution. You cannot have half a pixel or 1/27th of a pixel. Therefore, the statement that the cropping isn't exact is beside the point. Of course it isn't exact. The reason for this is that line art can be placed at a much higher precision, so a clip mask can cut a pixel in half visually but that does not change the size of the pixel in the image.

The correct problem statement is: PitStop aligns an image with a clip mask to the image instead of to the clip mask when using the Action "Move objects to corner".

I will log that as a bug, but there is an easy different approach that does it correctly: use the Action "Align or distribute objects". You will have to use the Action 2 times, one to align in the vertical direction and one in the horizontal direction. "Move page content to corner" also uses the clip mask by the way.
bill_billings
Newbie
Posts: 6
Joined: Tue Apr 23, 2024 8:49 pm

Re: Crop Image to the Clip Mask isn't exact

Post by bill_billings »

Hi Freddy,

Thanks for the reply!

That's interesting how the clipping mask works with images. I didn't know how that worked. It explains some "weird" behavior that I was seeing with images out of Indesign, in the relationship between the clipped image and the mask (this is with PDFs made straight out of Indesign with "Crop image data to frames" turned on in the PDF export settings.)

I guess I should explain what I'm trying to do with my action, maybe I'm barking up the wrong tree with my technique.

I'm somewhat new to this area of Pitstop Action scripting, it's a very deep program and so it's hard to find the most efficient way to do things; even trying to do something that seems "simple" can be daunting because of the huge array of choices of actions.

What I'm trying to do is create an action that will mirror an image+mask or a vector object around any of the 4 axis of that image (left, right, top, bottom.) I want to do it with any object on the page that I select, in any area of the page. The action will be run with "User Selection" only.


The procedure that I came up with, for reflecting an object along its right edge/axis:
1) Manually select the Image+Mask Object on the page
2) Manually copy/paste so that the object is pasted on top of itself (make sure in Pitstop preferences the offset for copy/paste is 0). This makes the copy the actively selected objects, and so actions will run on this copy of the objects.
3) Run this action ("User Selection"):

Code: Select all

a. Flip Selection Horizontally ("Visible Area of Selection" in Dropdown)
b. Resize art box to Selection
c. Move Objects to Corner ("Place center left of the graphic elements relative to the center right of the art box.")

The script works mostly as I expect with vector objects, but I ran into the problem with Image Masks and so I came here :). The "Move Objects to Corner" works better for me rather than the "Align" actions because with "Move Objects to Corner" I can pin to any edge of the art box (which would allow me to reflect in any direction horizontally or vertically.)

I was wondering is there a better way to do this?

Thanks for your help or advice you can give!


Here's my eal:
Here's the output with two types of simple objects:



Vector Mirror.png
Vector Mirror.png (116.68 KiB) Viewed 8820 times
Image-Mirror.jpg
Image-Mirror.jpg (132.66 KiB) Viewed 8820 times
bens
Advanced member
Posts: 282
Joined: Thu Mar 03, 2011 10:13 am

Re: Crop Image to the Clip Mask isn't exact

Post by bens »

Interestingly, we recently had a similar issue. I think you're on the right path. Try this:

Rotate objects as group, relative to the centre right of the visible area of the selection, 180 degrees.
Flip selection vertically, relative to the centre of the visible area of the selection.
Post Reply