Foros del Web » Programación para mayores de 30 ;) » .NET »

Marcas de agua o whatermark como las agrego

Estas en el tema de Marcas de agua o whatermark como las agrego en el foro de .NET en Foros del Web. como le agrego a un imagen una marca de agua WaterMark sobre ella. o algun texto.....
  #1 (permalink)  
Antiguo 21/05/2006, 13:12
Avatar de affv  
Fecha de Ingreso: diciembre-2002
Ubicación: Ahora aqui
Mensajes: 485
Antigüedad: 21 años, 4 meses
Puntos: 0
Marcas de agua o whatermark como las agrego

como le agrego a un imagen una marca de agua WaterMark sobre ella. o algun texto..
__________________
Todo tiene un comienzo y un fin!!
Postea tus proyectos
  #2 (permalink)  
Antiguo 21/05/2006, 13:54
Avatar de u_goldman
Moderador
 
Fecha de Ingreso: enero-2002
Mensajes: 8.031
Antigüedad: 22 años, 4 meses
Puntos: 98
A ver si esto te sirve:

http://www.dmxzone.com/ShowDetail.asp?NewsId=10287

Saludos
__________________
"El hombre que ha empezado a vivir seriamente por dentro, empieza a vivir más sencillamente por fuera."
-- Ernest Hemingway
  #3 (permalink)  
Antiguo 22/05/2006, 08:29
Avatar de lexus  
Fecha de Ingreso: enero-2002
Ubicación: Cali - Colombia
Mensajes: 2.234
Antigüedad: 22 años, 4 meses
Puntos: 4
mira este tambien es muy bueno


watermark.aspx
Cita:
<%@ Page Explicit="True" Language="VB" Debug="True" %>
<%@ Import Namespace="system.drawing" %>
<%@ Import Namespace="system.drawing.imaging" %>
<%@ Import Namespace="system.drawing.drawing2d" %>
<%@ Import Namespace="system.io" %>
<script runat="server">

dim Filename as String
dim Width, Height, shadowSize as Integer
dim Bitmap as system.drawing.bitmap
dim ImgFormat as ImageFormat
dim Img as System.Drawing.Image
Dim baseMap as Bitmap
dim top, left as Integer
sub CreateGraphic()
Dim letterBrush as SolidBrush = new SolidBrush(Color.FromArgb(50, 255, 255, 255))
Dim shadowBrush as SolidBrush = new SolidBrush(Color.FromArgb(50, 0, 0, 0))
Dim fontTitle as Font = new Font("tahoma", 20, FontStyle.Bold)
Filename = Request.QueryString("filename")
Filename = server.mappath(Filename)
ImgFormat = ImageFormat.jpeg : response.contenttype="image/jpeg" ' Default=jpeg '
Img = system.drawing.image.FromFile(Filename)
Width = Img.Width
Height = Img.Height
baseMap = new Bitmap(Width,Height)
Dim myGraphic as Graphics = Graphics.FromImage(baseMap)
with myGraphic
.DrawImage(Img, 0,0, Width,Height)
.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
.DrawString("LABS.INSERT-TITLE.COM", fontTitle, shadowBrush, 5, 60)
.DrawString("LABS.INSERT-TITLE.COM", fontTitle, letterBrush, 7, 62)
end with
Img.dispose()
end sub
</script>
<%
CreateGraphic
baseMap.Save(Response.OutputStream, ImageFormat.JPEG)
baseMap.dispose()
Img = Nothing
response.end
%>
<br />If you enjoyed this post <a href="<A href="http://del.icio.us/login?url=http%3A%2F%2Fwww.labs.inserttitle.com%2F labs%2FQuick-Watermark_article832.aspx;title=Quick+Watermark;v= 2">Bookmark">http://del.icio.us/login?url=http%3A%2F%2Fwww.labs.inserttitle.com%2F labs%2FQuick-Watermark_article832.aspx;title=Quick+Watermark;v= 2">Bookmark it at del.icio.us</a><br />
<div id="comm_space">
<hr />
<h3>Comments</h3>

<div class="comment">
<span class="comment_name">Chris Mc</span>
<span class="commentdate">2/21/2005 3:39:12 AM</span>
Fantastic script, just what i was after! </div>

<div class="comment">
<span class="comment_name">Gabe Taylor</span>
<span class="commentdate">5/27/2005 1:33:48 PM</span>
Why do I get the following error? Am I missing some ASP component?
<br /><br />
Thanks.
<br /><br />
-------------
<br /><br />
Active Server Pages error `ASP 0221`
<br /><br />
Invalid @ Command directive
<br /><br />
/onlocation/test.asp, line 1
<br /><br />
The specified `Page Explicit="True" Language="VB" Debug="True" ` option is unknown or invalid.
<br /><br />
------------- </div>

<div class="comment">
<span class="comment_name"><a href="<A href="http://www.cascadecomputing.com">gabe/">http://www.cascadecomputing.com">Gabe Taylor</a><br /></span>
<span class="commentdate">5/27/2005 1:34:32 PM</span>
Please email reply to [email protected] </div>

<div class="comment">
<span class="comment_name"><a href="<A href="http://www.insert-title.com">joe/">http://www.insert-title.com">Joe Maddalone</a><br /></span>
<span class="commentdate">5/27/2005 1:55:50 PM</span>
Save the first chunk of code as "watermark.aspx"
<br /><br />
Then in your ASP page make the src of the image:
<br /><br />
<img src="watermark.aspx?filename=FILENAME.JPG" />
</div>

<div class="comment">
<span class="comment_name">Gabe Taylor</span>
<span class="commentdate">5/27/2005 7:44:48 PM</span>
Hmm... I receive the following:
<br /><br />
Microsoft VBScript runtime error `800a01a8`
<br /><br />
Object required: ``
<br /><br />
/onlocation/images.html, line 4
<br /><br />
Line 4 being the one that has
<img src="watermark.aspx?filename=FILENAME.JPG" />
<br /><br />
Is there a component that I need for this to work that would not be part of ASP 3.0?
<br /><br />
Thanks. </div>

<div class="comment">
<span class="comment_name">Joe Maddalone</span>
<span class="commentdate">8/13/2005 10:57:38 AM</span>
This is ASP.NET you need at least the .Net Framework 1.0 or 1.1, which you can download for free form Microsoft. Just check Google for ".Net Framework download".
<br /><br />
FILENAME.JPG... replace that with the actualy filename of an actual image, on your actual server. </div>

<div class="comment">
<span class="comment_name">Antonio</span>
<span class="commentdate">11/12/2005 1:49:51 AM</span>
Great Code, And Thanks for share it.
I got some questions:
Why this piece of code is used twice?
<%
CreateGraphic
baseMap.Save(Response.OutputStream, ImageFormat.JPEG)
baseMap.dispose()
Img = Nothing
response.end
%>
<br /><br />
And A further question?
After Run it the process aspnet_wp.exe Start.
Even If I move to another page the process is running.
How Stop this proccess?
<br /><br />
Thanks in advance
</div>

<div class="comment">
<span class="comment_name">Joe Maddalone</span>
<span class="commentdate">11/14/2005 7:24:26 AM</span>
THe doubling up on the <% CreateGraphic baseMap... line is a typo - I`ll fix that today.
<br /><br />
Your other question is something I will look into for you. </div>

<hr />
<div class="google-inarticle" ID="inarticle">
0110 1001 1001 0110
</div>


<form name="comments_form" method="post" action="default.aspx?id=832" id="comments_form">
<input type="hidden" name="__VIEWSTATE" value="dDwtMTIzMTAwOTc3OTs7Ppi31DQd+zxtdd8TWDrrPB2 ih4j1" />
<h3>Leave a Comment</h3>
<label for="name">Name:</label>

<input name="name" type="text" id="name" />

<label for="url">URL:</label>

<input name="url" type="text" id="url" />
<br />
<br />
<label for="SubmitComments">Comments:</label>
<br />
<textarea name="SubmitComments" rows="10" cols="40" id="SubmitComments">
__________________
Control de Visitantes, Control de Accesos, Minutas digitales, Manejo de Correspondencia
http://www.controldevisitantes.com
  #4 (permalink)  
Antiguo 22/05/2006, 08:37
Avatar de affv  
Fecha de Ingreso: diciembre-2002
Ubicación: Ahora aqui
Mensajes: 485
Antigüedad: 21 años, 4 meses
Puntos: 0
ok gracias a ambos he estado mirando estos codigo y e logrado resumirlos a esto.
Código:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim Image As System.Drawing.Image
        Image = System.Drawing.Image.FromFile(Server.MapPath("Image.jpg"))
        Dim dummyCallBack As System.Drawing.Image.GetThumbnailImageAbort
        dummyCallBack = New System.Drawing.Image.GetThumbnailImageAbort(AddressOf ThumbnailCallback)
        Dim Graphic As System.Drawing.Image
        Graphic = Image.GetThumbnailImage(800, 600, dummyCallBack, IntPtr.Zero)
        Dim GraphicWithWaterMark As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(Graphic)
        Dim FontFamily As System.Drawing.Font = New System.Drawing.Font("Arial", 5, System.Drawing.FontStyle.Bold)
        Dim FontColor As System.Drawing.SolidBrush = New System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(255, 255, 255, 255))
        GraphicWithWaterMark.DrawImage(System.Drawing.Image.FromFile(Server.MapPath("Image.jpg")), 0, 0, 800, 600)
        GraphicWithWaterMark.DrawString("123", FontFamily, FontColor, 0, 0)
        Graphic.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg)
        Response.ContentType = "image/jpeg"
    End Sub
    Function ThumbnailCallback() As Boolean
        Return False
    End Function
ya que lo que necesito no es gran cosa como podria resumir aun mas este codigo.
Ustedes que cambios realizarian.
__________________
Todo tiene un comienzo y un fin!!
Postea tus proyectos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 04:12.