sorry. it should look like this
m_graphic.DrawImage(input,
Dale
Main Topics
Browse All TopicsHello Guys,
I've this problem where i have to create two images (thumbnail and mid sized image) for a high res (1280x1020) images.
I can generate the thumbnails fine no problem at all, but the problem comes when i try to resize it to a middle sized image (i.e. 500x400) the image size is always bigger than the original image size which it shouldn't be because its not a high res image (ie the width&heights are less)....
i tried to change CompositingQuality & InterpolationMode etc but to no success.
I don't what i'm doing wrong??? here is my code:
private Bitmap m_resized;
Bitmap input= new Bitmap(@"C:\highRes.jpg");
//Resize the image
m_resized = new Bitmap(resizedWidth, resizedHeight);
m_graphic = Graphics.FromImage(m_resiz
m_graphic.CompositingQuali
m_graphic.InterpolationMod
m_graphic.DrawImage(input,
//Clean up
m_graphic.Dispose();
m_resized.Save(@"C:\highRe
Thanks in advance
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
When you say "image size" do you mean the horizontal height and width in pixels or do you mean the number of bytes in the file? Your midsize image is a JPEG created with CompositingQuality.HighQua
If you mean the number of pixels is more, try:
m_graphic.DrawImage(input,
I took your code and put it to in an application. Here is the code as I used it
private Bitmap m_resized;
Bitmap input= new Bitmap(@"C:\Somefile.jpg")
int resizedWidth = 100; //Giving a static value for the example
int resizedHeight = 100; //Giving a static value for the example
Graphics m_graphic; //I am sure you have it declared elsewhere.
//Resize the image
m_resized = new Bitmap(resizedWidth, resizedHeight);
m_graphic = Graphics.FromImage(m_resiz
//m_graphic.CompositingQua
//m_graphic.InterpolationM
m_graphic.DrawImage(input,
//Clean up
m_graphic.Dispose();
m_resized.Save(@"C:\somefi
//Using the imageformat.jpeg
The original picture was 9.18 KB and after changing to the new size the file size was 2.61 KB
I hope this helps
Dale
drekow's last solution shoudl work fine, but the problem was the save. You had:
m_resized.Save(@"C:\highRe
while he entered
m_resized.Save(@"C:\somefi
If you don't actually specify the ImageFormat to save in, it will default to a PNG, which will be much larger than a jpg.
Hi,
Have you ever thought of streaming thumbnails just by passing query string indicating width or height of thumbnail you need, and most importantly passing those to image itself?
<img src=MyImage.jpg?Height=200
http://www.c-sharpcorner.c
Thanks
Business Accounts
Answer for Membership
by: drekowPosted on 2007-08-22 at 08:51:35ID: 19747259
on this line take out the new rectangle command. the drawimage will support (original pic,x,y,width,height) and that will do it for you.
new Rectangle(0, 0, m_resized.Width, m_resized.Height), 0, 0, input.Width, input.Height, GraphicsUnit.Pixel);
0,0,input. width,inpu t.height)
m_graphic.DrawImage(input,
would be something like this
m_graphic.DrawImage(input,
Dale