Ciao ragazzi, sapete se è possibile in asp.net incollare su un'immagine jpg un'altra immagine con un'alpha trasparenza del 70%?
Ciao ragazzi, sapete se è possibile in asp.net incollare su un'immagine jpg un'altra immagine con un'alpha trasparenza del 70%?
Ciao, con la classe Streaming puoi fare un po' tutto di seguito il codice viene usato per scrivere del testo sopra un' immagine. Puoi modificarlo a tue esigenze per sovrapporgli un' immagine, ma per l' alpha dovresti guardare su MSDN perchè è una cosa che non ho mai fatto :
Importati questi namespace
Il codice da usare :codice:System.Drawing; System.Drawing.Imaging; System.Drawing.Drawing2D; System.Drawing.Text;
Da qui mi sembra molto semplice sostituire il testo alla seconda immagine, per l' alpha ho scoperto devi usare graphicImage.aplha = ...codice:Carico l' immagine da scrivere a video. Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("dallen.jpg" ) ); Graphics graphicImage = Graphics.FromImage( bitMapImage ); //Uso antialias che la rende piu' carina ... graphicImage.SmoothingMode = SmoothingMode.AntiAlias; //Scrivo del testo. graphicImage.DrawString( "That's my boy!", new Font("Arial", 12,FontStyle.Bold ), SystemBrushes.WindowText, new Point( 100, 250 ) ); //Disegno un ovale intorno al testo. graphicImage.DrawArc(new Pen(Color.Red, 3), 90, 235, 150, 50, 0, 360); //Impostiamo il contentype per validare il tutto Response.ContentType="image/jpeg"; //Save the new image to the response output stream. bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg); //Laviamo via la sporcizia. graphicImage.Dispose(); bitMapImage.Dispose();
![]()
ok.. primo errore.
questo è lo script riportato paro paro
questo è l'errorecodice:<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %> <%@ Import namespace="System.Drawing" %> <%@ Import namespace="System.Drawing.Imaging" %> <%@ Import namespace="System.Drawing.Drawing2D" %> <%@ Import namespace="System.Drawing.Text" %> <script runat="server"> //Carico l' immagine da scrivere a video. Bitmap bitMapImage = new System.Drawing.Bitmap(Server.MapPath("dallen.jpg" ) ); Graphics graphicImage = Graphics.FromImage( bitMapImage ); //Uso antialias che la rende piu' carina ... graphicImage.SmoothingMode = SmoothingMode.AntiAlias; //Scrivo del testo. graphicImage.DrawString( "That's my boy!", new Font("Arial", 12,FontStyle.Bold ), SystemBrushes.WindowText, new Point( 100, 250 ) ); //Disegno un ovale intorno al testo. graphicImage.DrawArc(new Pen(Color.Red, 3), 90, 235, 150, 50, 0, 360); //Impostiamo il contentype per validare il tutto Response.ContentType="image/jpeg"; //Save the new image to the response output stream. bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg); //Laviamo via la sporcizia. graphicImage.Dispose(); bitMapImage.Dispose(); </script>
che faccio?Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
segui le istruzioni scritte![]()
apri il web.config e, se non la trovi, aggiunti la sezione <customErrors mode="Off" /> in modo da visualizzare il dettaglio dell'errore
![]()
no pain no gain!
ricordati che hai dei limiti...