Visualizzazione dei risultati da 1 a 5 su 5

Discussione: Proprietà immagine

  1. #1
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    331

    Proprietà immagine

    Salve,
    sto usando asp.net per creare le miniature di immagini.
    Funziona perfettamente solo che se metto delle immagini .gif con sfondo trasparente, le miniature vengono con sfondo nero.
    Come posso risolvere?

    Un'altra cosa è possibile migliorare la qualità delle miniature?

    GRAZIE

    Questo è il codice che uso per ridurre le immagini:

    codice:
        Sub sendFile()
        
          ' create New image and bitmap objects. Load the image file and put into a resized bitmap.
          dim g as System.Drawing.Image = System.Drawing.Image.FromFile(server.mappath(request("src")))
          dim thisFormat = g.rawformat
          dim imgOutput as New Bitmap(g, cint(request("width")), cint(request("height")))
        
          ' Set the contenttype
          if thisformat.equals(system.drawing.imaging.imageformat.Gif) then
                 response.contenttype="image/gif"
          Else
                 response.contenttype="image/jpeg"
          end if
        
        
        
          ' send the resized image to the viewer
          imgOutput.save(response.outputstream, thisformat) ' output to the user
        
          ' tidy up
          g.dispose()
          imgOutput.dispose()
        
          end sub
        
          Sub sendError()
        
          ' if no height, width, src then output "error"
          dim imgOutput as New bitmap(120, 120, pixelformat.format24bpprgb)
          dim g as graphics = graphics.fromimage(imgOutput) ' create a New graphic object from the above bmp
          g.clear(color.yellow) ' blank the image
          g.drawString("ERROR!", New font("verdana",14,fontstyle.bold),systembrushes.windowtext, New pointF(2,2))
        
          ' Set the contenttype
          response.contenttype="image/gif"
        
          ' send the resized image to the viewer
          imgOutput.save(response.outputstream, imageformat.gif) ' output to the user
        
          ' tidy up
          g.dispose()
          imgOutput.dispose()
        
        
          end sub

  2. #2
    Guarda non ne so molto, ma tempo fa chiesi la stessa cosa e purtroppo con le gif non c'è nulla da fare, lo sfondo diventa nero.
    Ciao

  3. #3
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    331
    e per quanto riguarda la qualità?

  4. #4
    Se vuoi mantenere una qualità accettabile devi ridimesionare le img in proporzione a quella originale cioe' se la grande è 100x50 la miniatura ti conviene farla di 10x5 sempre mantenedo h e l in proporzione

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2004
    Messaggi
    331
    la proporzione c'e ma nn c'è la qualità dei dettagli... oltre al nero di sfondo ....

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 © 2026 vBulletin Solutions, Inc. All rights reserved.