How to replace a color / "colorize" an image

Post questions on how to use or achieve an effect in Inkscape.
jdcrowley
Posts: 4
Joined: Sun Jan 16, 2011 1:54 pm

How to replace a color / "colorize" an image

Postby jdcrowley » Sun Jan 16, 2011 2:05 pm

I have a black and white image, of which I want to do two things:

1) Take all the white parts and make it a single color
2) Make the black background transparent

Essentially I want to be left with a monochrome image that I can make any color I want. The image is too detailed to use the paint bucket, as there are small groupings of white throughout the image.

Help!?

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to replace a color / "colorize" an image

Postby brynn » Sun Jan 16, 2011 7:28 pm

Image
Welcome jdcrowley!

First question, before I can answer: Is the image already SVG, or is it a raster format (PNG, GIF, JPG, etc.)?

ivan louette
Posts: 215
Joined: Thu Aug 21, 2008 4:08 am
Location: Belgium

Re: How to replace a color / "colorize" an image

Postby ivan louette » Sun Jan 16, 2011 8:16 pm

I join a file with two filters (which are in fact two setting of the same one). They should do the job for bitmap images as for vector shapes.

Simply open the file and import or cut and paste the image or object inside. Then, open Filters/Filters Editor and click on one or the other filter (left of its name).

To change the color, click on Flood and then on the colored rectangle at the bottom, that will open a dialog with a color selector and a color picker.

Tell me if that's what you need.

ivan
Attachments
alphas.svg
(2.19 KiB) Downloaded 659 times

llogg
Posts: 443
Joined: Tue Mar 11, 2008 7:30 am

Re: How to replace a color / "colorize" an image

Postby llogg » Mon Jan 17, 2011 3:06 am

If it's a bitmap and ivan's filters aren't what you're looking for, I would use Path>Trace Bitmap>Colors with Scans set at 2. This will give you two paths - one for the black areas and one for the white areas. These paths will be grouped by default. Select the group and ungroup the paths (ctrl+shift+g). Now you can use the path operations to get your black areas transparent. I'm not sure if you want to do Path>Difference or Path>Intersection
monochrome.png
monochrome.png (43.91 KiB) Viewed 47976 times

jdcrowley
Posts: 4
Joined: Sun Jan 16, 2011 1:54 pm

Re: How to replace a color / "colorize" an image

Postby jdcrowley » Mon Jan 17, 2011 6:40 am

brynn wrote:Image
Welcome jdcrowley!

First question, before I can answer: Is the image already SVG, or is it a raster format (PNG, GIF, JPG, etc.)?


The native image is a .GIF, but I can convert it to any format that I need to (if it makes it easier)

jdcrowley
Posts: 4
Joined: Sun Jan 16, 2011 1:54 pm

Re: How to replace a color / "colorize" an image

Postby jdcrowley » Mon Jan 17, 2011 6:44 am

ivan louette wrote:I join a file with two filters (which are in fact two setting of the same one). They should do the job for bitmap images as for vector shapes.

Simply open the file and import or cut and paste the image or object inside. Then, open Filters/Filters Editor and click on one or the other filter (left of its name).

To change the color, click on Flood and then on the colored rectangle at the bottom, that will open a dialog with a color selector and a color picker.

Tell me if that's what you need.

ivan


I'm not sure if I am doing this correctly. I imported my .GIF image, and went to Filter Editor.
Once there, I clicked on "New" for filter, then selected "Flood" in the "Add Effect" section.
From there, I clicked on a color, but nothing happened. I'm stuck.

jdcrowley
Posts: 4
Joined: Sun Jan 16, 2011 1:54 pm

Re: How to replace a color / "colorize" an image

Postby jdcrowley » Mon Jan 17, 2011 7:01 am

llogg wrote:If it's a bitmap and ivan's filters aren't what you're looking for, I would use Path>Trace Bitmap>Colors with Scans set at 2. This will give you two paths - one for the black areas and one for the white areas. These paths will be grouped by default. Select the group and ungroup the paths (ctrl+shift+g). Now you can use the path operations to get your black areas transparent. I'm not sure if you want to do Path>Difference or Path>Intersection
monochrome.png


So this seemed to have worked fairly well, although I'm still stuck with a monochromatic image. How do I then take this Black image, and change the color?

llogg
Posts: 443
Joined: Tue Mar 11, 2008 7:30 am

Re: How to replace a color / "colorize" an image

Postby llogg » Mon Jan 17, 2011 2:13 pm

just change the fill

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: How to replace a color / "colorize" an image

Postby brynn » Mon Jan 17, 2011 2:37 pm

Is there some reason that you particulary need to have in vector format? Because otherwise, what you want to do would better be done in a raster graphics program (such as GIMP), since it's already in raster format (GIF).

If you do need it vectored, then indeed, Trace Bitmap is your best option. After you have traced it, you can use the Replace Color extension, to replace the white(Extensions menu > Color > Replace Color). As for making the background transparent, Inkscape backgrounds are transparent by default.

Actually in Trace Bitmap, there's the SIOX Foreground Selection option. Please read my tutorial: viewtopic.php?f=6&t=6616 It will remove your black background, and I assume make it transparent. But if it doesn't, you can make it transparent with the Document Properties dialog -- instructions in same tutorial.

Note, while ivan is the filters guru, if you are new to Inkscape, the Filters Editor is probably a bit too advanced for you, imo (unless you know other graphics programs very well). No offense, ivan :D

ivan louette
Posts: 215
Joined: Thu Aug 21, 2008 4:08 am
Location: Belgium

Re: How to replace a color / "colorize" an image

Postby ivan louette » Mon Jan 17, 2011 7:04 pm

jdcrowley wrote:I'm not sure if I am doing this correctly. I imported my .GIF image, and went to Filter Editor.
Once there, I clicked on "New" for filter, then selected "Flood" in the "Add Effect" section.
From there, I clicked on a color, but nothing happened. I'm stuck.


You don't need to click on "New", only click on one of the two little boxes left to the two filters names "Alpha positive" or "Alpha negative". That will apply one of the two filters to your image.

ivan louette
Posts: 215
Joined: Thu Aug 21, 2008 4:08 am
Location: Belgium

Re: How to replace a color / "colorize" an image

Postby ivan louette » Mon Jan 17, 2011 7:08 pm

brynn wrote:Note, while ivan is the filters guru, if you are new to Inkscape, the Filters Editor is probably a bit too advanced for you, imo (unless you know other graphics programs very well). No offense, ivan :D


Not offended ;) But I am so impatient to see customizable filters we are working on implemented into the program !

ivan


Return to “Help with using Inkscape”