convert a clipping mask into a crop
It would be great to be able to convert a clipping mask into a crop.
Indeed, the link got broken. Perhaps Dropbox made some changes.
Please try this one. Also share some feedback after you use the script.
Sergei Berman commented
Can you re-upload the script? Link does not work
OK, UV does not allow scripts, so here’s the link:
Hey, Mark and others.
I asked Sergey Osokin (https://github.com/creold/illustrator-scripts/) for help and after some fiddling with the script written by Carlos Canto we now have the script that does crop the image to the clipping mask — which is something I always wanted, so I’m pretty happy.
The mask stays, the clip group stays, but the image is now cropped to have only pixels that fit into the mask’s bounding box.
The size of this image is obviously going to be slightly larger than bounding box (you can't cut a pixel). Sometimes you get an extra row/column, but you got to be lucky.
Position stays (oh, it took us some time to workaround).
If you crop an RGB image in CMYK workspace, it’d become CMYK — obviously, because it gets embedded if it was linked.
Please try it out and share your feedback here.(Edited by admin)
Mark R commented
This would be super useful and save a bunch of time. Currently when you click 'Crop Image' the crop location is pretty random. Most of the time I don't want to crop an image until I check it out with a clipping mask first. In fact most of the I don't think it's a good workflow to be committing to cropping an image before at least looking at it as a clipping mask. But once you've put the work into making a clipping mask you shouldn't have to make the rectangle again. Either or both, the 'Crop Image' button should default to the shape of the clipping mask, and/or a 'Crop Image to Clipping Mask...' option should be added to as an Image right click drop-down menu to when it already has a clipping mask.
If an image already has a clipping mask having to click and drag after clicking 'Crop Image' is just non-intuitive. It should already be in the boundary of the clipping mask as default.
I've wanted a simple "crop everything below" feature for 13 years...
The only way to crop multiple objects at the same time (without destroying shapes and messing up gradients within the crop) is to use the "Divide objects below" which cuts through everything below like a cookie cutter. But then you have to delete everything outside your crop shape manually afterwards which can take really long time if you're working with complex shapes and a tons of objects.
"Divide objects below" also screws up gradients completely (by applying the gradients to the new shapes created) so it only works with solid fills. And it doesn't cut stroked open paths either so they have to be expanded first.
Clayton Shima commented
Now, to do the same with vectors, I guess that development would have to deal with so many problems, it may not even be worth the time. On top of that, I would rather not have noob designers use such a feature, as it would make the work of doing modifications to art a near impossible thing. Let the beginner illustrators keep all the artwork intact but just masked. We veterans appreciate.
Clayton Shima commented
For raster images, you can already do this within Illustrator.
1-Copy the vectors of the mask (JUST the vector, not the image contained inside!)
2-Deselect all and click to selected the mask + masked image set
3-Set the mixing option in the Transparency palette to Multiply
4-Paste the mask vector in back (Ctrl + B) and paint it white
5-Shift+click to selected also the mask + masked image set again.
6-Group (Shift + G)
7-From the Object menu, select "Flatten transparency", setting quality adequately
(This may create segmented images, which you may optionally just rasterize again as a whole single image.)
This will create a standalone raster image in the size of the mask. However, this process is not perfect, and if you need precise pixels around the borders of the image, you might still need a mask to create crisp edges.
Ribeye Design commented
I have wanted this feature for years, would be very handy and time saving.
Jotham, not exactly. Trim also destroys art in the middle of the mask, which should here stayed as it is.
Pathfinder - trim does exactly what you are asking if it's vector elements. Astute graphics made a plugin that does it for raster images, but it would be nice if Adobe implemented it as well.
Very interested in being able to crop or trim elements outside of a mask or clipping path and delete them as an option!!