Skip to content

jujumo/inkex_color_trace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Color from Bitmap : Inkscape extension

version 2.0

brief

Grab color from underlying bitmap and apply it to path objects. The color is averaged all over the path area. Erode parameter can be used to shrink or expand (using negative value) this area.

example klimber

Options

  • Sensitivity: Erodes (see morpho math transformations) the footprint of the shape onto the image. It can be used to emphasize the contrast. If negative value is given, it will dilate the area, and then smoothen the contrast between adjacent areas.

  • Fill color: How to replace the inner color of selected shapes. It can be unchanged, nofill (Empty color), average.

  • Stroke color: How to replace the stroke color of selected shapes. It can be unchanged, nofill (Empty color), average.

  • scale_x_min and scale_x_max: will remap the image intensity to a scale factor on horizontal axis. If both values are set to 1.0, it will have no effect.

  • scale_y_min and scale_y_max: same as scale_x_min and scale_x_max on vertical axis. Copy scale x if you want to keep aspect ratio.

  • intensity: Method used to evaluate light intensity on a pixel. sRGB takes the raw RGB values, linear make convert to values proportional to light emission.

Known limitations

  • Only consider a single image. If multiple bitmaps are selected, only one is considered.

  • Only handle path objects: does not work on rectangles, circles, …​ Make sure to convert objects to paths.

  • Only works with straight paths: bezier area are approximated using straight lines.

  • Dilatation (negative erosion) have weird corners.

  • Ignore any clipping on the image.

  • slow

Low poly tutorial

In this example, I describe how to use this extension to speed up a low poly design.

First, place markers at key places (triangles corners). See below example.

dots

Then generates a triangle mesh, using a delaunay triangulation, as shown below:

menu1
dialog1

Once you have the following mesh,

mesh

you can colorize it, using the "from bitmap" color extension. Make sure you have both the image and the mesh selected.

menu2

Choose your settings, and apply.

dialog2

You should end up with colorized objects, like below:

colorized

Black stripes tutorial

Import an image, and create a 1x1 square.

mona1

Use Create Tiled Clones to make an array of squares over the entire image. You might proceed in 2 steps (first horizontal and then vertical clones) to avoid inkscape to overheat.

mona2

Un-clone and convert all squares to path. Regroup all squares into a group for convenience.

mona3

Select both image and group of squares, and open the color from bitmap extension.

mona4

In the parameters, set:

  • fill color to No change

  • stroke color to No color

  • scale x min and scale x max to 1.1 and 0.0: it will shrink light pixels,

  • scale y min and scale y max to 1.0 and 1.0: it leave vertical scale untouched,

mona5

Hit apply:

mona6

You should end up with a retro-looking stripe. To simplify the drawing, you can:

  • select all scaled squares

  • merge them using "Path > union"

  • simplify using "Path > Simplify"

Et voilà:

mona7

See more about this fun example at: ombre_double.

About

inkscape extension: color objects from bitmap

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages