Inkscape FAQ: How do I crop in Inkscape?

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 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: Selection_032

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

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

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

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

Selection_040Then choose Path> IntersectionSelection_041

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.  Selection_044

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:

Selection_047

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.

Selection_045Then, 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.
Selection_046Now, 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:

exportpage2

About these ads

14 thoughts on “Inkscape FAQ: How do I crop in Inkscape?

  1. This feature is great but not strictly better than a true crop, especially when exporting to different programs that interpret xml data differently. Inkscape desperately needs true cropping functionality.

    Like

    • Inkscape is primarily a vector graphics editor, so “cropping” in the traditional sense of cropping a photo does not really apply.

      Clipping in inkscape is the closest you are going to get to a crop. If you are using paths, maybe a boolean operation is what you are after.

      Like

  2. When clipping, I find it very helpful to make the clipping path (in your case the gray shape) *transparent*. So that I can adjust it, while seeing what’s underneat it, before actually do the clipping.

    Like

  3. There is a fourth method, a variation of your third method: You can export a png without changing the document size. In your third method, select the rectangle that will define the “cropping” area, optionally move it to a separate layer called Export, set the rectangle’s transparency to 0 (or simply hide the Export layer) – now, *while this rectangle is still selected* (even if it is hidden), go to File > Export PNG – Choose *Selection* (instead of Page), set the name, and export the image.
    In this manner, you can define several export rectangles (and even export them all at once with Batch export selection). I use this method when designing web pages, exporting parts to be included in a html web page.

    Like

  4. thanks for your help. not sure why inkscape is so hard for me to learn….used photoshop and illustrator for years (photoshop mush more) but for some reason inkscape feels to me like I am in someone else’s kitchen and I cannot find the knives.

    teando.com

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s