how to extract images without the background

Post questions on how to use or achieve an effect in Inkscape.
user
Posts: 45
Joined: Mon Oct 25, 2010 7:18 am

how to extract images without the background

Postby user » Wed Oct 27, 2010 10:09 pm

hello

in this file there are some gears:
http://ifile.it/hx6ry0/gears1.svg

I would like to have in a file of 600dpi resolution of only the gears shown here:
http://ifile.it/law89s/gears2.jpg

but the gears without the white background, so that I can paste them in another photo and retain the image behind the gears

can anyone upload this?

thanks
Last edited by user on Thu Oct 28, 2010 7:19 am, edited 1 time in total.

Mazui
Posts: 18
Joined: Mon Oct 25, 2010 10:07 pm

Re: how to extract images without the background

Postby Mazui » Thu Oct 28, 2010 12:38 am

Select the white part, then the green part below, then hold the ctrl key and press dash (-) on your keyboard.

Instead of the keyboard shortcut you can use the "difference" option on the curve menu.

The gears2.jpg link only shows hamburger ads, no gears. So you will have to do the work yourself. :)

user
Posts: 45
Joined: Mon Oct 25, 2010 7:18 am

Re: how to extract images without the background

Postby user » Thu Oct 28, 2010 1:31 am

ok I update the link:

http://img441.imageshack.us/img441/4997/12940.png

it's a bunch of gears near the center

it would be best to have each of these gears in a seperate file and be able to copy/paste them on the photo i want , without any white background

can anyone do it please?
Last edited by user on Thu Oct 28, 2010 7:19 am, edited 1 time in total.

Ailurus
Posts: 115
Joined: Fri Oct 22, 2010 9:53 am
Location: The Netherlands
Contact:

Re: how to extract images without the background

Postby Ailurus » Thu Oct 28, 2010 1:53 am

Why don't you do it yourself? :). Mazul explained how to accomplish it. Just download the program and have some fun fixing your images.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: how to extract images without the background

Postby ~suv » Thu Oct 28, 2010 2:01 am

user wrote:I would like to have in a file of 600dpi resolution of only the gears shown here: <link snipped>
but the gears without the white background, so that I can paste them in another photo and retain the image behind the gears

Use 'File > Export Bitmap…' instead of saving as 'Cairo PNG'. In the 'Export bitmap…' dialog you can choose between Page|Drawing|Selection for export and also adjust the dpi (resolution) to your needs. The background in the exported PNG files defaults to transparent (unless you change the alpha value and color of the background in 'File > Document Properties').

user
Posts: 45
Joined: Mon Oct 25, 2010 7:18 am

Re: how to extract images without the background

Postby user » Thu Oct 28, 2010 7:29 am

~suv wrote:
user wrote:I would like to have in a file of 600dpi resolution of only the gears shown here: <link snipped>
but the gears without the white background, so that I can paste them in another photo and retain the image behind the gears

Use 'File > Export Bitmap…' instead of saving as 'Cairo PNG'. In the 'Export bitmap…' dialog you can choose between Page|Drawing|Selection for export and also adjust the dpi (resolution) to your needs. The background in the exported PNG files defaults to transparent (unless you change the alpha value and color of the background in 'File > Document Properties').


ok, now I can have the photo in 600dpi in png

but how do i select all the colors (thus all the gears) in an area of the whole png that i specify? and then copy/paste it in another photo?

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: how to extract images without the background

Postby ~suv » Thu Oct 28, 2010 10:40 am

user wrote:but how do i select all the colors (thus all the gears) in an area of the whole png that i specify?
Not sure if I really understood what your question is about: if you click once on the content of the "gears1" SVG file, the message in the notification area (in the status line at the bottom of the Inkscape window) tells you that you have selected a group with 255 objects:

To select individual members of a group you can either
  1. 'Ctrl+click' on an individual object (use 'Shift+Ctrl+click' to add other objects to the current selection) or
  2. enter the group with 'double-click' or 'Ctrl+<Enter>' and now use the normal selection methods to pick the objects you want to export as selection to a bitmap (PNG).
user wrote:and then copy/paste it in another photo?
Into another photo? Inkscape doesn't edit bitmap (aka raster) images: in the SVG file, you make a selection, open the 'File > Export Bitmap…' dialog, choose 'Selection' at the top, adjust dpi and file name as needed and export. You can then use a raster image editor (like GIMP) or a smaller tool (like Irfanview) to paste the exported PNG into your photo.

user
Posts: 45
Joined: Mon Oct 25, 2010 7:18 am

Re: how to extract images without the background

Postby user » Thu Oct 28, 2010 7:58 pm

ok the result is not satisfying at all:

http://img830.imageshack.us/img830/382/125331.png

1) the resolution is not 600dpi, or even if it is, the quality is poor (surprising since the source is an SVG file)
2) it did not extract only the gear, it included a part of the other gear that is near

I only need one gear in 600dpi quality file
what can be done?

Mazui
Posts: 18
Joined: Mon Oct 25, 2010 10:07 pm

Re: how to extract images without the background

Postby Mazui » Thu Oct 28, 2010 9:00 pm

How hard can it be? Set the size of your object (at the mouse cursor in the screenshot) then the dpi in the export dialogue.

screenshot.png
screenshot.png (81.17 KiB) Viewed 4922 times
Attachments
gears.png
gears.png (106.08 KiB) Viewed 4922 times

user
Posts: 45
Joined: Mon Oct 25, 2010 7:18 am

Re: how to extract images without the background

Postby user » Thu Oct 28, 2010 9:42 pm

i follow the below steps, can you tell me which needs fix?

- load the svg file that contains all the gears
- i zoom it (shift +) to find the gear i want
- i select a gear with triple clicking on the gear
- a rectangular appears that includes the gear (but it includes part of the tooth of the above gear)
- i click "export bitmap", i choose selection, i set 600.00 dpi at "bitmap size" and i click "export"

but the result is not like yours...

what is missing?

how much should i set the size of the object? i only know the dpi i need, not the exact size
and why it includes the part of the tooth of the above gear? it is like it takes a screenshot, while it should only include the specific object (gear)

thanks

Mazui
Posts: 18
Joined: Mon Oct 25, 2010 10:07 pm

Re: how to extract images without the background

Postby Mazui » Thu Oct 28, 2010 9:56 pm

Never mind the triple click, click once and press ctrl-shift-g to ungroup all those gears. Then select what you want to export. It may be a good idea to group your selection now for easier handling. ctrl-g

You need to know the final size of the image, if you don't the dpi value is irrelevant. dpi means "dots per inch" and if you don't know how many inches it will be, how will you know how many dots will be required?

If you look at the screenshot again, there's a checkbox at the bottom of the export dialogue: "Dölj alla utom markerade". That means "Hide everything except the selection", and should take care of other gears intruding in your picture.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: how to extract images without the background

Postby ~suv » Thu Oct 28, 2010 10:16 pm

Mazui wrote:Never mind the triple click, click once and press ctrl-shift-g to ungroup all those gears. Then select what you want to export.
The triple click enters the group and selects the object or group under the cursor - why not use it?

Mazui wrote:You need to know the final size of the image, if you don't the dpi value is irrelevant.
In Inkscape's export bitmap dialog you cannot set the bitmap size and dpi (resolution) independently: if you change the size for the exported bitmap, the resolution is recalculated; if you change the dpi the size of the bitmap is adjusted.

user
Posts: 45
Joined: Mon Oct 25, 2010 7:18 am

Re: how to extract images without the background

Postby user » Thu Oct 28, 2010 10:21 pm

thanks for your reply

i managed to do it

now is it possible to fill a specific area with all the gears i extracted (of various diameter) without overlapping each other and without leaving too much space?

is there any way to do it or only manually?

also, I want to delete the round green gear of the screenshot above, I click to select it (few clicks) and then I click ctrl+x and inkscape closes itself :S

thanks

Mazui
Posts: 18
Joined: Mon Oct 25, 2010 10:07 pm

Re: how to extract images without the background

Postby Mazui » Thu Oct 28, 2010 10:42 pm

~suv wrote:
Mazui wrote:Never mind the triple click, click once and press ctrl-shift-g to ungroup all those gears. Then select what you want to export.
The triple click enters the group and selects the object or group under the cursor - why not use it?


It seemed to me that is was there he ran into trouble. Actually ungrouping the thing felt like a better way to make certain that nothing would go wrong.


Mazui wrote:You need to know the final size of the image, if you don't the dpi value is irrelevant.
In Inkscape's export bitmap dialog you cannot set the bitmap size and dpi (resolution) independently: if you change the size for the exported bitmap, the resolution is recalculated; if you change the dpi the size of the bitmap is adjusted.


Was that meant for me, or a clarification for user?

Mazui
Posts: 18
Joined: Mon Oct 25, 2010 10:07 pm

Re: how to extract images without the background

Postby Mazui » Thu Oct 28, 2010 10:48 pm

user wrote:now is it possible to fill a specific area with all the gears i extracted (of various diameter) without overlapping each other and without leaving too much space?


I'm not sure.. I guess you could play around with tiled clones, but it may well be that doing it manually will be quicker.

http://wiki.inkscape.org/wiki/index.php/Tiled-Clones

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: how to extract images without the background

Postby ~suv » Thu Oct 28, 2010 11:48 pm

user wrote:now is it possible to fill a specific area with all the gears i extracted (of various diameter) without overlapping each other and without leaving too much space?

is there any way to do it or only manually?

Are you talking about arranging the exported PNG images as collage into one big raster image or SVG file? Or do you want to copy some of the original vector groups and objects into a new Inkscape document?

(You could do the first by importing all bitmap images (PNG) into a new Inkscape document and using 'Objects > Rows & Columns' to arrange them evenly spaced without overlaps. For vector objects: select a group or object as you did for exporting to bitmap, but instead, copy it and paste it into the second (new) Inkscape document. Then you can arrange them with 'Object > Rows&Columns' too.)

If you want to use (some of) the gears as seamless pattern, consider using custom patterns (open new document, import one of the exported PNGs, or copy&paste some gears in vector format, select what you want to use as pattern and apply 'Object > Pattern > Objects to pattern'. The pattern can then be used as fill for any shape or object you create in this Inkscape document.)

user
Posts: 45
Joined: Mon Oct 25, 2010 7:18 am

Re: how to extract images without the background

Postby user » Sat Oct 30, 2010 1:35 am

thanks

is it possible to select an area (by dragging a rectangular and like that selected all the inlcuded objects?

also to lock the selection of each object i click without having to hold 'shift' ?

thanks

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: how to extract images without the background

Postby ~suv » Sat Oct 30, 2010 2:42 am

user wrote:is it possible to select an area (by dragging a rectangular and like that selected all the inlcuded objects?

Inkscape manual -- Selecting with the Mouse:
  • Left Mouse Drag: Select Multiple Objects: When started from empty space, this will select all objects that are completely within the rectangle that is formed by the start and stop points of the drag. This is often referred to as rubber-band selecting. The rubber band is the temporary line drawn while dragging.
  • Shift+Left Mouse Drag: Add Objects to Collection: Add objects within the rubber band to a preexisting selection. Also inhibits selection of an object under the start of the drag (without the shift, an object under the start of a drag is selected and moved). Selected objects within the rubber band are not deselected.
  • Alt+Left Mouse Drag: Touch Select Multiple Objects: This will select all objects that the mouse cursor touches while being dragged. A red line will indicate the path the cursor took. This is very useful when needing to select multiple paths as found in engravings or hair. Holding the Shift down will prevent dragging an already selected object if the drag begins over that object.
  • Shift+Alt+Left Mouse Drag: Touch-Add Multiple Objects to Collection: This will add all objects touched to a selection. It can also be used when the drag begins over an already selected object.
Note there is no selection mode to select all objects that are fully or partially inside a rubber-band selection (feature request: Two types of selection frame)

user wrote:also to lock the selection of each object i click without having to hold 'shift' ?
Not that I am aware of, no.


Return to “Help with using Inkscape”