ThumbnailImage

G

Giuseppe Dini

If I want to reduce an image I can do as follows:

Sub sub1()
Dim FileUrl As String = Server.MapPath("") & "\a.jpg"
Dim ima As New System.Drawing.Bitmap(FileUrl)
Dim inp As New IntPtr()
Dim ima2 As System.Drawing.Bitmap
ima2 = ima.GetThumbnailImage(100, 100, Nothing, inp)
Response.ContentType = "image/jpeg"
ima2.Save(Response.OutputStream, ima.RawFormat)
ima.Dispose()
ima2.Dispose()
End Sub

or

Sub sub2()
Dim FileUrl As String = Server.MapPath("") & "\a.jpg"
Dim ima As New System.Drawing.Bitmap(FileUrl)
Dim ima2 As New System.Drawing.Bitmap(ima, 100, 100)
Response.ContentType = "image/jpeg"
ima2.Save(Response.OutputStream, ima.RawFormat)
ima.Dispose()
ima2.Dispose()
End Sub

what are the advantages of GetThumbnailImage? I can the same thing without
using it.
 
H

Herfried K. Wagner [MVP]

Giuseppe Dini said:
what are the advantages of GetThumbnailImage? I can the same thing
without using it.

'GetThumbnailImage' will return a thumbnail image which is embedded into the
image, if present. This would make getting the thumbnails faster. However,
the quality of embedded thumbnails is often horrible.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top