Watermark an Image with an Image

Hey guys, I am a bit stuck and need your help.

I have the need to load images programmatically via script, and when the image is loaded, I need to watermark it __with another image__

Please do not send me links about adding text onto an image, i know how to do that already and that is not what I need.

I simply cannot find anything on how to take an image, and save another image on top of it... is it possible to use the Graphics class to open a 'canvas' and a second 'canvas' and overlay them on top of each other? I am at a loss :(

Any help you guys could provide would be greatly appreciated.

Thanks in advance,

John
[code]<%
'// Programmed By: Zantos
'// VisualProgramming.NET
'// http://vp.funurl.com/
'// [email protected]
%>[/code]

Comments

  • I was able to find out how to do this, and I shall share the code here with you guys! (Works only for JPEG/PNG as far as I can tell/tested)

    [code]
    Sub Page_Load

    'get original bitmap
    Dim original As System.Drawing.Image = New Bitmap(Server.MapPath("original.jpg"))
    Dim logo As New Bitmap(Server.MapPath("logo.png"))

    Dim gra As Graphics = Graphics.FromImage(original)
    gra.DrawImage(logo, New Point(0,70))

    'Set the content type
    Response.ContentType="image/jpeg"

    'send the thumbnail bitmap to the outputstream
    original.Save(Response.OutputStream, ImageFormat.jpeg)

    'tidy up
    logo.Dispose()
    original.Dispose()

    End Sub
    [/code]
    [code]<%
    '// Programmed By: Zantos
    '// VisualProgramming.NET
    '// http://vp.funurl.com/
    '// [email protected]
    %>[/code]
  • According to your description, I think you need [link=http://www.rasteredge.com/how-to/csharp-imaging/load-from-net-graphics/]load image from .NET graphics in C#.NET[/link].AND you can follow the step below to Load Image from .NET Graphics.
    Run Microsoft Visual Studio (2005 or later version);
    Create a project with programming language - Visual C#;
    Add RasterEdge.DotNetImaging.dll to your Visual C# applications;
    Call RasterEdge .NET Image Namespace:


  • According to your description, I think you need [link=http://www.rasteredge.com/how-to/csharp-imaging/load-from-net-graphics/]load image from .NET graphics in C#.NET[/link].AND you can follow the steps below to Load Image from .NET Graphics.
    Run Microsoft Visual Studio (2005 or later version);
    Create a project with programming language - Visual C#;
    Add RasterEdge.DotNetImaging.dll to your Visual C# applications;
    Call RasterEdge .NET Image Namespace.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories