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

Rispondi quotando