473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Image resize with Smoothing (anti alias)

Jay
Hi guys, trying to fix a problem with an image resize routine. The code
posted below uploads and resizes a jpeg, probablem is, the outlook can look
a bit bitty becuase of teh samller size...is there a way I can anti alias /
smooth the resized image before saving?
If myThumb.ContentLength > 0 Then
Dim myThumbData(myThumb.ContentLength) As Byte

myThumb.InputStream.Read(myThumbData, 0, myThumb.ContentLength)

Dim FileStream As New System.IO.FileStream(strTempSavePath &
"rawupload-thumb.jpg", IO.FileMode.Create)

FileStream.Write(myThumbData, 0, myThumb.ContentLength)

FileStream.Close()

' 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(strTempSavePath & "rawupload-thumb.jpg")

Dim thisFormat = g.RawFormat

Dim intThumbSize As New Size

intThumbSize = NewImageSize(g.Width, g.Height, 90, 90)

' Create bimap in memory to manipulate image.

Dim imgOutput As New Bitmap(g, intThumbSize.Width, intThumbSize.Height)

Response.ContentType = "image/jpeg"

' Resize done, now save the file back to the temp directory.

imgOutput.Save(strTempSavePath & "upload-thumb.jpg", thisFormat)

' Tidy up the objects

g.Dispose()

imgOutput.Dispose()

' Set URL for uploaded image to be previwed on page where this control is
included.

imgThumb.ImageUrl = "/catalogue/images/tmp/upload-thumb.jpg"

imgThumb.Visible = True

End If
Jul 21 '05 #1
0 2272

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michel | last post by:
Is there a way I can anti-aliasing a gif to be able to get a hi-quality resizeable backgroundpicture. When a GIF of JPG is being resized by the browser you get wurse pictures because it needs a...
6
by: anonymous | last post by:
hi all, I'm trying to use the capCreateCaptureWindow (see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_capcreatecapturewindow.asp) in a Windows...
1
by: M West | last post by:
continuation of my previous post, thanks to all those that contributed with answers I am creating a control that will take an image and make parts of it transparent, this is done by creating and...
0
by: Jay | last post by:
Hi guys, trying to fix a problem with an image resize routine. The code posted below uploads and resizes a jpeg, probablem is, the outlook can look a bit bitty becuase of teh samller size...is...
15
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the...
4
by: John Swan | last post by:
Hello. I'm trying to create a simple program that amongst other things creates a thumbnail of an image (Bitmap) to a set size determined by the user in pixels? The problem is: All of the...
2
by: HKSHK | last post by:
Hello, I've got this problem: I loaded an icon (with alpha and smoothing) into a graphics object. Now I want to display it. The best solution would be if I could convert it into an image...
8
by: infoseekar | last post by:
Image Resize & Rotation Hi I have 2 scripts, one for Image rotation and other image resize and they both are working. Image resize scripts load the picture and resize it and Image rotation...
14
anfetienne
by: anfetienne | last post by:
hi.....i have this script (below #1) that is linked to another php file SimpleImage.php (#2) im trying to get it to work on my uploaded images but it keeps coming up errors.....i haven't altered...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.