I shared above the test image I want to set an outline to. Of course, this is an example of what I want to work on.
The outline is not a rectangle nor a circle nor , but a two pixels (or more) black dots all around (and inside the two 'a’s) the image.
Ive made two kinds of searches: programmatically (and that leaded to create two masks ) and via google: most of the answers are about how to add a rectangle around the graphic (with or without a graphic software ).
My google search sentence ended to:
site:stackoverflow.com Draw a black outline around a figure -matlab -Adobe -matplotlib -Text
I get two different results with my current code:
the same image, but black instead of red,
the above inverted image (the original image in white, the remainding of the image is black).
Now, I test two pixels in two loops: the first is white, the second is not white: I draw a black pixel. That meant (in my mind) I found the first pixel of an image, but I was wrong, this does not works.
I am short of testing ideas / google search sentence.
In a two loops (x,y: For x =0 to Image.Width / for y = 0 to image.Height): Search in the horizontally: the first non white dot and draw a black one 1 pixel before it
the next non white dot and draw a black one 1 pixel after it
Search in the vertictally:
the first non white dot and draw a black one 1 pixel before it
the next non white dot and draw a black one 1 pixel after it
My original code do only one search/draw, the one from yesterday do two search/draw (horizontal) and I added the two vertical searches/draw minutes ago…
Do you still need 2 loops if you make the “Pen” 2-3 pixels wide?
And how about not looking for white/non white pixel, but checking the HSV values and put a dot if a hue or saturation value is above/blow a specific value?
I do not know, I started with two loops and I do not even use the loop indices
Thats an idea to follow.
The base idea is to use the magic wand to get low colored (non black) pixels and then to add a black outline (for better looking) instead or using the pen and eraser who will take hours to do
I prefer to use a click in a button instead of wasting hours
Usually, when I get the code in mind before writing a project, I have it complete; this time I do not realised I only have 25%
If it’s always Text and you know the font, type & content, just draw the String 2 times. First a bit taller and drak and then in it’s targetet size with the correct color above the first string.
Or create a Mask, make it bigger and draw the image a bit darker and then the original above it (needs an alpha).
Scan the Image pixel by pixel and draw points where needed (as you did now).
Blur the image, make it a bit darker and draw the original on top of it.
Id better use a different image. Of course, visually, this looks like text, but this is an image (as will be everything I will outline).
OK. Back to the loops: I removed one of the two loops (alternatively, x, then y): both are needed.
The Mask idea can be followed; I do not think at that.
You probably do not realized, but the main use will be for Comics logo. Some can be representing text, some may represent real artworks. Most of the time, there is black or dark around (sometimes above) the text / artwork. Using the magic want allow me to take the inside of the logo; I can complete it, then I have to outline it.
As long as the result is like you want it to be, your method is fine. I’d recommend to not full the Image Size over and over again. I think performance wise, it’s a bit faster do it like this:
[code]Dim intWidth As Integer = Image.Width
Dim intHeight As Integer = Image.Height
Dim X,Y As Integer