Visualizzazione dei risultati da 1 a 2 su 2

Discussione: watermak su file gif

  1. #1
    Utente di HTML.it L'avatar di SPEED78
    Registrato dal
    Jan 2003
    Messaggi
    358

    watermak su file gif

    salve ragazzi secondo voi è possibile fare il watermark con uan scritta su una foto gif? :master:

  2. #2
    Utente di HTML.it L'avatar di SPEED78
    Registrato dal
    Jan 2003
    Messaggi
    358
    io utilizzo questo codice che funziona benissimo su file jpg :

    codice:
    rivate Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ServerClick
            Dim foto As System.Drawing.Image
    
            foto = System.Drawing.Image.FromStream(File1.PostedFile.InputStream)
            Dim fotodamodificare As System.Drawing.Graphics
            fotodamodificare = fotodamodificare.FromImage(foto)
            ' Scelgo la font e le dimensioni della scritta
            Dim drawFont As Font
            Dim Pennello As Brush
            drawFont = New Font("Verdana", 16, FontStyle.Bold)
            Pennello = New SolidBrush(Color.FromArgb(200, 255, 255, 90))
    
            Dim drawPoint As New PointF(0.5F, 0.5F)
            fotodamodificare.DrawString("LBJSHOP", drawFont, Pennello, drawPoint)
            Dim mystream As New System.IO.MemoryStream
    
    
    
            foto.Save(mystream, System.Drawing.Imaging.ImageFormat.Jpeg)
            Dim fotomodificata As System.Drawing.Image
            fotomodificata = fotomodificata.FromStream(mystream)
            fotomodificata.Save(Server.MapPath("public/result.jpg"))
            fotodamodificare.Dispose()
    
            Response.Write("ciao")
        End Sub
    sui file gif mi da questo errore:



    A Graphics object cannot be created from an image that has an indexed pixel format.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Exception: A Graphics object cannot be created from an image that has an indexed pixel format.

    Source Error:


    Line 31: foto = System.Drawing.Image.FromStream(File1.PostedFile.I nputStream)
    Line 32: Dim fotodamodificare As System.Drawing.Graphics
    Line 33: fotodamodificare = fotodamodificare.FromImage(foto)
    Line 34: ' Scelgo la font e le dimensioni della scritta
    Line 35: Dim drawFont As Font


Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.