Working with areas of an image lazarus / 39-Graphics ---------------------------------------------------------------------- xinyiman · 2016-09-04 10:12 Hello guys, I wanted to ask. When I have a picture like the one attached. Let us imagine that I want to draw a green outline to one of the teeth simply by clicking on it and if I click a second time on board disappears. How should I do? ---------------------------------------------------------------------- Thaddy · 2016-09-04 11:06 Start with studying this example: /packages/imagemagick/examples/wanddemo.lpr ---------------------------------------------------------------------- xinyiman · 2016-09-04 11:17 Is a cross-platform Solutions?! ---------------------------------------------------------------------- Thaddy · 2016-09-04 11:30 Yes, for every platform that is supported by imagemagick (many!). ---------------------------------------------------------------------- lainz · 2016-09-04 13:22 LazPaint also comes with a magic wand tool, you can start here: https://github.com/bgrabitmap/lazpaint/blob/master/lazpaint/utoolselec t.pas#L34 Seems that uses the function ParallelFloodFill of BGRABitmap: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Manager.Ima ge.SelectedImageLayerReadOnly.ParallelFloodFill(pt.X,pt.Y,toolDest,pen Color,fmDrawWithTransparency,Manager.ToolTolerance); ---------------------------------------------------------------------- circular · 2016-09-05 09:35 Indeed, what you can do is to have a second image that contains the selection. First fill it with black. Then when there is a click, check that it is within a tooth (that it is white) and then do a parallel floodfill in white on the selection image. You can draw the highlighted selection different ways, for example by calling FillMask on the display image to give some color to the selected tooth. If instead of highlighting the tooth, you want the border of the selected tooth, you can use Contour filter on the selection or EmbossHighlight filter. ---------------------------------------------------------------------- Thaddy · 2016-09-05 10:59 Since that is a solution that is written completely in Object Pascal, I actually like that more than imagemagick You may even try to Black-out all teeth and combine all but the one that needs to disappear. Kind of layers (actually: then you would use layers) Well done Circular!