locked
Create a "Crisp" Watermark Image? RRS feed

  • Question

  • User797956788 posted

    I'm trying to dynamically place a logo on all photos displayed on my web site by using an HTTP handler.  While I've found a few articles (such as this one on CodeProject.com) or the method shown below from a Microsoft MapPoint web service tutorial, I've been having problems getting my watermark image to look 'crisp'... i.e., not have jaggy edges.

    So far, it seems like using a PNG with a transparent background yields the best results.  The edges of my watermarked image are a tad blurry, but better than if I use a transparent GIF.  Is there some other image format I can use or other technique I can try that will allow me to keep my logo (watermark image) nice and 'crisp'?  It would be nice if the watermarked image could start as an EPS (encapsulated post script) with no background color, but I don't think that is an option?

    Microsoft MapPoint Web Service Code Snippet

    1    [C#]
    2    private void DrawOnMap(Graphics mapGraphics)
    3    {
    4       Bitmap waterMark=new Bitmap(Request.PhysicalApplicationPath +
    5    System.IO.Path.DirectorySeparatorChar + "store_locator.gif",false);
    6       ImageAttributes attr=new ImageAttributes();
    7       attr.SetColorKey(Color.White,Color.White);
    8       Rectangle rect=new Rectangle(0,0,waterMark.Width,waterMark.Height);
    9       Rectangle rect2=new Rectangle(mParams.MapWidth - waterMark.Width ,
    10   mParams.MapHeight - waterMark.Height , waterMark.Width , waterMark.Height);
    11      mapGraphics.DrawImage(waterMark , rect2 , rect.X , rect.Y ,
    12   rect.Width , rect.Height , GraphicsUnit.Pixel , attr);
    
     

    Some Test

    Sunday, October 8, 2006 5:12 PM

Answers

  • User797956788 posted

    Well, to answer my own question...

     It does appear that using a PNG over a transparent GIF allowed me to have a pretty clear logo overlayed onto my photos.   One thing that made a huge difference was making sure that both the photo and the logo image were the same resolution (72 x 72 dpi in my case).  Here is the result (with some text and a semi-transparent background):

    Photo with logo and text watermark

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 10, 2006 9:38 PM