2014-04-22



One of the most frequently asked questions from Inkscape users is “how do i crop an image or object?”. Inkscape is primarily a vector graphics editor, so when someone asks this question, they could possibly mean something slightly different to a traditional image crop. This FAQ explains a few of the techniques that people actually mean when they say they want to crop in inkscape.

What do you mean when you say “crop”

If you have a complex drawing with many shapes and objects, and want to trim these, then Clipping is probably the solution for you. (click here to jump to how to do this)

If you have a single path or object (like a star or a rectangle), and want to trim or crop that object down, then Boolean Operations is probably what you need. (click here to jump to how to do this)

If you are exporting your inkscape document (SVG) to a bitmap (a PNG) with the “File > Export Bitmap” command, and want to only export a portion of your document, then changing the document size, and just exporting the document is probably the solution for your needs. (click here to jump to how to do this)

 

Clipping

The Clipping feature is an easy and versatile way to crop vector or bitmap/raster objects in Inkscape. Let’s start with our little monster friend that i downloaded from the Open Clip Art Library:



Our monster is actually a group of 21 objects (a mixture of Ellipses and Paths). When clipping, it is always easier to group the objects being clipped. Grouping objects is as simple as selecting 2 or more objects and choosing Object > Group.



Choose the Rectangle Tool from the Toolbar, and draw a Rectangle over our poor little monster’s face.

Select both the the monster (the group) and the Grey Rectangle (a rectangle object). After selecting both, Choose Object > Clip > Set from the menu.

…and our monster is now cropped in a nice neat rectangle.

But what has happened to the rest of the monster? Well, one of the awesome things about the Clipping feature in Inkscape is that it is non-destructive.  We can remove the clip at any time by selecting the clipped object, and then choosing Object > Clip > Release from the menu.

…and now our monster is back to normal! Well, the rectangle that was clipping him before is still there, but trust me, so is the monster.

But can you crop your image with something other than a rectangle? Yes! Clipping in inkscape can be done with a wide range of clipping objects, including Text Objects…

Circle and Ellipse objects…

and Stars and Polygons.

Even a path can be used as a clipping object.

In fact, if you use a path as the clipping object, you can actually edit the clip path without having to Release it. First select the clipped object, then choose the Node Editing Tool. Your clip path will be outlined Green, with the normal path editing nodes visible.

Now, you can edit this path, and change the area that is clipped / cropped.

Clipping is one feature in inkscape that you will use time and time again. When working with imported bitmap / raster images, clipping is a easy way to crop without having to open up the GIMP. Additonally, when combined with blur, you can achieve some awesome effects like simple bubbles.

Boolean Operations

If you have a single path or object (like a star or a rectangle), and want to trim or crop that object down, then Boolean Operations is probably what you need. In Inkscape, you can use Boolean Operations to “crop” vector objects. This method works best if you have a single vector object that you want to trim. Note also, that unlike Clipping, this operation is destructive, you are deleting data from your SVG. This just covers one boolean operation (intersection) to achieve a basic “crop”. There are many other boolean ops in inkscape too.

Take the following landscape lineart that was vectorised with Inkscape:

It is a single filled-in path with no stroke:

To “Crop” this object, simply draw a rectangle over it, select both the rectangle and the landscape beneath:

And choose Path > Intersection from the menu. Your landscape should now be cropped:

Additionally, you can “Crop” vectors into shapes other than rectangles, for example, draw a shape:

Then choose Path> Intersection: 

Changing the Document size

If you are exporting your inkscape document (SVG) to a bitmap (a PNG) with the “File > Export Bitmap” command, and want to only export a portion of your document, then changing the document size, and just exporting the document is probably the solution for your needs.

Consider we have the following landscape drawn in inkscape. Note that the black box around the landscape is the document boundary. 

If we were to go File > Export Bitmap (changed to File > Export PNG in newer versions of inkscape), and Set the export area to Page, we would get something like this:

To change the Document Boundary to a better size, and “Crop” our output, first draw a rectangle over where you want to “crop” the document to.

Then, select the black box, and go to File > Document Properties, and choose “Resize Page to Drawing or Selection”. The Page boundary should resize to the size of the box. Note that you may need to check the box “Border on top of drawing” to see the page boundary. Also delete the black box.
Now, when you use File > Export Bitmap (changed to File > Export PNG in newer versions of inkscape), and Set the export area to Page, your output should be a “cropped” version of our entire document:

Show more