473,765 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Content Length > 0 Then
Dim myThumbData(myT humb.ContentLen gth) As Byte

myThumb.InputSt ream.Read(myThu mbData, 0, myThumb.Content Length)

Dim FileStream As New System.IO.FileS tream(strTempSa vePath &
"rawupload-thumb.jpg", IO.FileMode.Cre ate)

FileStream.Writ e(myThumbData, 0, myThumb.Content Length)

FileStream.Clos e()

' 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.Wi dth, intThumbSize.He ight)

Response.Conten tType = "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.Dispo se()

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

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

imgThumb.Visibl e = True

End If
Jul 21 '05 #1
0 2323

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

Similar topics

3
4281
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 anti-aliasing. Maybe there is some filter for it... Or can I write my own subroutine to do this in client-browsers?
6
2950
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 Application Project. I want to pass Image as one of the parameter but I figure that an Image doesn't have a handle. Previously I had it working in a Web Application Project using the handle of a PictureBox. Is there any workaround? Please help and...
1
3355
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 then applying a region to the control. The control inherits from picturebox and works fine when loading the image into the control, the problem that I am having now is, once the control is loaded and the image is displayed, if the user resizes...
0
419
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 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)
15
5363
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 path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
4
2573
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 examples I have seen so far are in c#. Can anyone please provide reference to a c++ managed version. Thanks. John
2
2714
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 object so the picture box can display it. Does anybody have an idea how I could do that?
8
9425
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 rotate the image by 90 deg. They are two differennt files i.e. resize.php and rotate.php. What I want to do is to combine both rotate.php & resize.php files, so when the script resized the image than it will call rotate script to rotate the...
14
3726
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 anything except for: $image->load('picture.jpg'); $image->resize(546,403); $image->save('picture2.jpg'); I put the variables i need in there within " " instead of ' ' and i always get a error message.....am i doing something or cant...
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.