Question how to delete part of a watermark

inkedgfx

Well-known member
Joined
Sep 29, 2012
Messages
139
Location
USA
Programming Experience
Beginner
I am in need of some assistance!

I need to delete part of a watermark on an image. I have the watermark being drawn twice but the second one is drawn 2 pixels offset from the first. what I want to do is delete the overlapping watermark. the watermark on the bottom is the shadow , I would like to delete this overlapping part and leave the 2 pixels for a shadow effect.

any help with this is appreciated

InkedGFX
 
You can't delete something that you've drawn. It's not like the colours are layered on top of each other and you can remove what you've drawn to see what was there originally. Once you draw something it replaces what was there so that is lost forever. What you need to do is just not draw the parts you don't want in the first place, or else draw the original back over the top.
 
I am drawing a watermark from a textbox , whatever the user puts in the textbox will be drawn .I draw the watermark twice... but they are offset by 2 pixels one is drawn in the color of the image and the other is drawn in black...for a shadow effect...what I want to do is delete everything that is drawn in black except the 2 pixels shadow effect on the second watermark.

NewImage.DrawString(qtxtWaterMark.Text, wmFont, myBrush, posX + 2, posY + 2)
NewImage.DrawString(qtxtWaterMark.Text, wmFont, myBrushShadow, posX, posY)

Thank You
InkedGFX
 
jmcilhinney is right, why are you creating something you don't want? And maybe I am interpreting this wrong, so you need to provide a lot more information than you are at the moment, but assuming the font size will be large enough to actually serve its purpose as a visible watermark, why are you drawing the shadow-text over the main-text instead of the other way around?

Also, you mention that one piece of text is drawn in the color of the image and the other is drawn in black. What exactly do you mean by "drawn in the color of the image" because my interpretation based on the 2 lines of code you provided is that the image is a solid color and you are drawing text in that same color, therefore you cannot see what you have just drawn?

I took your code and made a couple of simple changes and everything looks fine to me, no deletion necessary, so again, you are going to have to provide more information. Show us an image of the product of your code and then show us what it is you would like to achieve.
 
ok...maybe i am asking the wrong question here.....let me ask a different way...how do I draw just the 2 pixel shadow under the watermark?

What exactly do you mean by "drawn in the color of the image"

I loop thru the image width and height to get the "image color" I use the color that appears the most in the image as the watermark color.

Inkedgfx
 
Is it something similar to this that you are after?
 

Attachments

  • gorEdit.jpg
    gorEdit.jpg
    37.9 KB · Views: 43
Take what you already had...

NewImage.DrawString(qtxtWaterMark.Text, wmFont, myBrush, posX + 2, posY + 2)
NewImage.DrawString(qtxtWaterMark.Text, wmFont, myBrushShadow, posX, posY)

InkedGFX



And reverse the brushes...

NewImage.DrawString(qtxtWaterMark.Text, wmFont, myBrushShadow, posX + 2, posY + 2)
NewImage.DrawString(qtxtWaterMark.Text, wmFont, myBrush, posX, posY)



You were drawing the main test first and then the shadow over it.. You should be drawing the shadow first and then the main text over it...
 
I have tried to reverse the brushes , but when I set the opacity of the top watermark the black shows thru and darkens the top watermark...I need to just draw a 2 pixel shadow on the top watermark...can you help with this?

thank You for your help so far . I really do appreciate it.

InkedGFX
 
Why set opacity? I thought you had an algo to set the color of the watermark itself? Maybe convert that color to a lighter shade.. instead of:

Dim myBrush As New SolidBrush(Color.FromArgb(108, 139, 155))  ' the colors from my example



try


Dim myBrush As New SolidBrush(Color.FromArgb(int((108 * 1.1)), int((139 * 1.1)), int((155 * 1.1))))
 
this code does not give me the desired effect I was going for...

I need to set the opacity to let the image show thru so the watermark is faint but readable.

is there a way to just draw the shadow as a 2 pixel offset to the watermark?

InkedGFX
 
To be honest, I think something like that would be more difficult than it's worth.. I have no experience with graphics so what I have shown you already is only what I learned today. Better for me to step aside and let someone more experienced take over.

Good Luck
 
ok...I appreciate all the help.....I know this is going to be more difficult but i think it will be worth it in the end.

InkedGFX
 
Back
Top