How to export a bitmap without extra whitespace around it

Asked by Richard Mansfield

Every time I try to export a bitmap (of a simple rectangle for example) the saved file includes a frame of canvas (the white background). I want to only save the actual rectangle itself--not have to crop it later in another graphics program. Please help.

Question information

Language:
English Edit question
Status:
Solved
For:
Inkscape Edit question
Assignee:
No assignee Edit question
Solved by:
Mc
Solved:
Last query:
Last reply:
Revision history for this message
Brynn (brynn4inks-deactivatedaccount) said :
#1

If I understand what you mean, you'll need to have the rectangle (or whatever) with a transparent background. Inkscape's background is transparent by default (yes, even though it looks white -- Inkscape does not use the typical checkerboard pattern to indicate transparency....well, not on the canvas anyway -- you will see it in the color controls thoug.).

So all you need to do is 1) don't change the default background, and 2) make sure to have the rectangle (or whatever) with nothing else behind it.

There may be some other things to think about as well. The Export Bitmap dialog provides numerous options for the export, some of which include Page, Drawing, Selection, and Custom. If your page is the default A4 size, and your rectangle is only 100 x 50 px, and you use the Page option, the resulting image will be the A4 size with the small rectangle somewhere within (assuming the rectangle on the canvas is inside the page border in the first place).

So if you want only the rectangle, there are at least 2 options. 1 - Select the rectangle, and export using the Selection option. Or 2 - Use Document Properties > Page tab > Page size > Resize page to content, which will make the page size fit the rectangle (or whatever) exactly. Then export using Page option. And there are some other ways to do it, but those will be the easiest.

I don't know if this will apply to you, but if you're on a Mac, and you pasted the rectangle (or whatever) there's a bug that gives it an opaque bg. You can avoid that by not using Copy/Paste, and instead, use Duplicate.

Revision history for this message
Richard Mansfield (richardm52) said :
#2

Thank you so much for the info. I guess I'm still a little confused. Here are the steps:
1. Start a new project.2. Drag a rectangle3. Choose Filters > Bevels > Bright Metal.
As soon as you add a filter (seems not to matter which one), instantly the selection rubber band (or the dark curved arrows)--anyway, the selection expands to add white space. The selection is no longer tight against the rectangle, but has expanded.
I'm using Windows.Thanks.

.....

> To: <email address hidden>
> From: <email address hidden>
> Subject: Re: [Question #250098]: How to export a bitmap without extra whitespace around it
> Date: Wed, 11 Jun 2014 22:41:32 +0000
>
> Your question #250098 on Inkscape changed:
> https://answers.launchpad.net/inkscape/+question/250098
>
> Status: Open => Answered
>
> Brynn proposed the following answer:
> If I understand what you mean, you'll need to have the rectangle (or
> whatever) with a transparent background. Inkscape's background is
> transparent by default (yes, even though it looks white -- Inkscape does
> not use the typical checkerboard pattern to indicate
> transparency....well, not on the canvas anyway -- you will see it in the
> color controls thoug.).
>
> So all you need to do is 1) don't change the default background, and 2)
> make sure to have the rectangle (or whatever) with nothing else behind
> it.
>
> There may be some other things to think about as well. The Export
> Bitmap dialog provides numerous options for the export, some of which
> include Page, Drawing, Selection, and Custom. If your page is the
> default A4 size, and your rectangle is only 100 x 50 px, and you use the
> Page option, the resulting image will be the A4 size with the small
> rectangle somewhere within (assuming the rectangle on the canvas is
> inside the page border in the first place).
>
> So if you want only the rectangle, there are at least 2 options. 1 -
> Select the rectangle, and export using the Selection option. Or 2 - Use
> Document Properties > Page tab > Page size > Resize page to content,
> which will make the page size fit the rectangle (or whatever) exactly.
> Then export using Page option. And there are some other ways to do it,
> but those will be the easiest.
>
> I don't know if this will apply to you, but if you're on a Mac, and you
> pasted the rectangle (or whatever) there's a bug that gives it an opaque
> bg. You can avoid that by not using Copy/Paste, and instead, use
> Duplicate.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/inkscape/+question/250098/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/inkscape/+question/250098
>
> You received this question notification because you asked the question.

Revision history for this message
Best Mc (mc...) said :
#3

filters have an effect on a zone 120% (by default) the size of the object they are working on (this is necesary cause they can have effects bigger than the object, e.g. blur)

2 solutions :
-select your object, go to filter->filter editor->filter general settings, and put (0,0) as coords and (1,1) as filter dimensions, which will explicitely tell the filter not to be bigger than the object (but can cause some filter to malfuction -usually it's fine-)
-or clip your filtered object with a duplicate of the original rectangle. This way, export will take the clip into account and not take too much space.

Revision history for this message
Richard Mansfield (richardm52) said :
#4

That did it! Thanks so much.