473,398 Members | 2,812 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,398 software developers and data experts.

Resize Image!!

Hi all,

I am trying resize an image using the following code.

//resize image
System.Drawing.Image ImageUpload =
System.Drawing.Image.FromFile(String.Concat(Server .MapPath(FilePath),ImageName));

// create the actual thumbnail image
System.Drawing.Image ThumbnailImage =
ImageUpload.GetThumbnailImage(250,ImageUpload.Heig ht * 250 /
ImageUpload.Width, new
System.Drawing.Image.GetThumbnailImageAbort(Thumbn ailCallback),
IntPtr.Zero);
ThumbnailImage.Save(ImageName)); //ie: test.jpg

However i keep getting this error:
Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Any one have any ideas?
Cheers,
Adam
Apr 7 '06 #1
2 1628
DWS
Adam
What line is error?

Thanks
DWS
"Adam J Knight" wrote:
Hi all,

I am trying resize an image using the following code.

//resize image
System.Drawing.Image ImageUpload =
System.Drawing.Image.FromFile(String.Concat(Server .MapPath(FilePath),ImageName));

// create the actual thumbnail image
System.Drawing.Image ThumbnailImage =
ImageUpload.GetThumbnailImage(250,ImageUpload.Heig ht * 250 /
ImageUpload.Width, new
System.Drawing.Image.GetThumbnailImageAbort(Thumbn ailCallback),
IntPtr.Zero);
ThumbnailImage.Save(ImageName)); //ie: test.jpg

However i keep getting this error:
Exception Details: System.Runtime.InteropServices.ExternalException: A
generic error occurred in GDI+.

Any one have any ideas?
Cheers,
Adam

Apr 7 '06 #2
Take a look at this...
http://www.howtodothings.com/compute...humbnails.html

I seem to remember having to process it from memory. If I recall correctly
the GDI+ error only occurred if I tried to process an image from disk that I
had only just saved, which is why I decided to process from memory instead.

Pete
Apr 7 '06 #3

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

Similar topics

4
by: Julia Briggs | last post by:
I am struggling to create a PHP function that would take a specified image (JPG, GIF or PNG) from a link, and resize it down to a thumbnail so it will always fit in a 200x250 space. I am hoping...
1
by: John Scott | last post by:
I am storing an image in an SQL database and have one field as an image datatype. I am also using a webservice to transport data. I want to be able to resize the image and pass back a thumbnail...
1
by: David | last post by:
Hello. How can I resize image in Bitmap object?
3
by: DichkoSoft | last post by:
Dear All I don't know haw i resize inage in VB.NET I want load image with size 800x600 then rezize it to 80x60 pixels and save to a file. -- DichkoSoft
1
by: Arjen | last post by:
Hi, I want to resize an image on my server. I tried a lot of samples... but all the time it does resize and saves the images but I can not view the image insize a webbrowser. With an...
6
by: Bob Bedford | last post by:
Hi all, I've a classic upload form where people may select images on their computer to send on my website. Since this is done by people not very confortable with computers, some sent pictures...
6
by: Bob Bedford | last post by:
Hi all, I've to resize uploaded images with the "imagecopyresampled" but when I've images quite large (common those days) I reach the 16mb limits of the ISP. How can I fix this ? I absolutely...
3
by: Danny Ni | last post by:
Hi, I am looking for a way to display images with different aspect ratio into frames with fixed width and height, the problem is some images will look distorted if they are forced into fixed...
3
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
how can i reesize an image so its quallity will stay the same as the original 1? thnaks in advance peleg
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.