User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 375,195 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,163 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 5040 | Replies: 47
Reply
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: add watermark in image

  #11  
Jan 29th, 2008
Its fine working.Thanks.I have one more doubt regarding watermark text size.I have same size images.In one image,watermark text is large font.In another one image small font size.I want watermark text as standard format,size and also according to image size.
below code for text size.
SizeF textSize = graphic.MeasureString(watermark, myFont);

int x =100;
int y= 100;
PointF pointF = new PointF(x, y);
graphic.DrawString(watermark, myFont, brush, pointF);
x += Convert.ToInt32(textSize.Width);
y += Convert.ToInt32(textSize.Height);

If u want please verify my earlier attachment.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: add watermark in image

  #12  
Jan 29th, 2008
You need to set the font size depending on the size of the image. Now how long is your watermark, and how far across the image do you want it to be? In my example, it is set at 70% of the image's size. So if this was my images' size:
---------------------------
|                         |
|                         |
|WaterMarkText 70%        |
|                         |
|Water Mark 50%           |
---------------------------
Therefore, if you wish your watermark to be 70% of the picture width, you need to divide your pictures width by the ratio.

Look at my earlier example. It is always set to 75% of the picture. So if the picture is 6000 pixels in width, my text will always take up 4500 pixels. If it is only 100 pixels in width, it will take up 75 pixels.
Last edited by SheSaidImaPregy : Jan 29th, 2008 at 9:47 am.
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: add watermark in image

  #13  
Jan 30th, 2008
gdfgdsfgdfgdf
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: add watermark in image

  #14  
Jan 30th, 2008
Watermark text size related to image resolution.If image resolution is 100 means text size is small if it is >300 text size too large.can we change the image resolution at the upload time. or can we set text doesnt relate with resolution.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: add watermark in image

  #15  
Jan 30th, 2008
It should relate to the resolution, it should relate to the width of the image.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: add watermark in image

  #16  
Jan 30th, 2008
Oh I see what you're saying. Yes you can set it to a certain size period. Keep this in mind though that if the picture is small, your watermark may "run off" the picture. Instead of setting the watermark text to a resized font size, just set the font size!
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: add watermark in image

  #17  
Jan 30th, 2008
Without text size problem Its working good in local.If i upload files it doesnt work in site.I think problem in specifying the image path that is

Image image = Image.FromFile(context.Request.PhysicalPath);

what is the exact path specification instead of this.
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: add watermark in image

  #18  
Jan 30th, 2008
I didnt set watermark text to a resized font size,I just set the font size!

Font myFont = new Font("Arial", 18);
SolidBrush brush = new SolidBrush(Color.FromArgb(80, Color.White));
At run time it takes like that.
Reply With Quote  
Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: add watermark in image

  #19  
Jan 30th, 2008
can I see the graphics? Take a screen shot of a smaller one and a larger one so I see the scope of your problem. Thanks.
Reply With Quote  
Join Date: Dec 2007
Posts: 84
Reputation: nandhinijp is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 4
nandhinijp nandhinijp is offline Offline
Junior Poster in Training

Re: add watermark in image

  #20  
Jan 31st, 2008
The first image(bird) has a resolution 300.second one 100.I think In that class there is no relation between text size and resolution.
Last edited by nandhinijp : Jan 31st, 2008 at 1:05 am.
Attached Images
File Type: jpg 72031016bird1_showimage[1].jpg (26.8 KB, 4 views)
File Type: jpg 20649968Aishwarya-Rai-2[1]_showimage[1].jpg (24.5 KB, 3 views)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 2:15 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC