473,396 Members | 1,810 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,396 software developers and data experts.

Image quality c#

I need little help in my situation.
I am reading a graphic file (jpg) from disk and then
resizing it and save resized image. What happens, it gets
blured, I want to retain same quality so that small image
won't be blur?

any tips or idea or technique?

Thanks in Advance.
Nov 15 '05 #1
3 12375
When resizing the best you can do is use the HighQualityBilinear or
HighQualityBicubic interpolation modes. Making an image smaller will
inevitably result in averaging of the pixels which can make the image appear
blurred, When enlarging the image, you may see blurring due to magnification
and interpolation.

Not using the high quality interpolation modes will result in aliasing which
is much worse than blurring.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Zahid Khan" <zk***@ivey.com> wrote in message
news:00****************************@phx.gbl...
I need little help in my situation.
I am reading a graphic file (jpg) from disk and then
resizing it and save resized image. What happens, it gets
blured, I want to retain same quality so that small image
won't be blur?

any tips or idea or technique?

Thanks in Advance.

Nov 15 '05 #2
Bob,

Can you point to any example code that does image resizing using the
bilinear interpolation modes? Is the interpolation provided by the graphic
driver or is it core system functionality?

Thanks,

Eric

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:#r**************@TK2MSFTNGP10.phx.gbl...
When resizing the best you can do is use the HighQualityBilinear or
HighQualityBicubic interpolation modes. Making an image smaller will
inevitably result in averaging of the pixels which can make the image appear blurred, When enlarging the image, you may see blurring due to magnification and interpolation.

Not using the high quality interpolation modes will result in aliasing which is much worse than blurring.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Zahid Khan" <zk***@ivey.com> wrote in message
news:00****************************@phx.gbl...
I need little help in my situation.
I am reading a graphic file (jpg) from disk and then
resizing it and save resized image. What happens, it gets
blured, I want to retain same quality so that small image
won't be blur?

any tips or idea or technique?

Thanks in Advance.



Nov 15 '05 #3
When you resize the image you'll create an in-memory image and get a
graphics object for it somenthing like this...

Bitmap bm=new Bitmap(newsize.Width, newsize.Height);
Graphics g=Graphics.FromImage(bm);

At this point you can set the interpolation mode...

g.InterpolationMode=InterpolationMode.HighQualityB ilinear;

When you draw your image to the new bitmap, the interpolation mode will be
used...

g.DrawImage(oldImage,new
Rectangle(0,0,oldImage.Width,oldImage.Height),0,0, bm.Width,
bm.Height,GraphicsUnit.Pixel);
g.Dispose();

Now save the image...

oldImage.Dispose();
bm.Save(filename,ImageFormat.bmp);

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Eric Johannsen" <no*********@johannsen.us> wrote in message
news:d%***************@newssvr14.news.prodigy.com. ..
Bob,

Can you point to any example code that does image resizing using the
bilinear interpolation modes? Is the interpolation provided by the graphic driver or is it core system functionality?

Thanks,

Eric

"Bob Powell [MVP]" <bob@_spamkiller_bobpowell.net> wrote in message
news:#r**************@TK2MSFTNGP10.phx.gbl...
When resizing the best you can do is use the HighQualityBilinear or
HighQualityBicubic interpolation modes. Making an image smaller will
inevitably result in averaging of the pixels which can make the image

appear
blurred, When enlarging the image, you may see blurring due to

magnification
and interpolation.

Not using the high quality interpolation modes will result in aliasing

which
is much worse than blurring.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Zahid Khan" <zk***@ivey.com> wrote in message
news:00****************************@phx.gbl...
I need little help in my situation.
I am reading a graphic file (jpg) from disk and then
resizing it and save resized image. What happens, it gets
blured, I want to retain same quality so that small image
won't be blur?

any tips or idea or technique?

Thanks in Advance.


Nov 15 '05 #4

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

Similar topics

1
by: Sean | last post by:
i am writing a class that visual demonstrates the result of changing the quality of a jpeg. the intention is to do this by saving the file and a selected quality, then reloading it to get an idea of...
5
by: Popoxinhxan | last post by:
HI guy I am working on the web application that required to display the chart image on the page. The process is clicking the button and browser will popup another windows that displayed...
6
by: Chris D | last post by:
Hi, I have an application where a user uploads an image and I create two thumbnails. One a small image and the second is a larger image but still smaller then the original. I store these in SQL...
6
by: neverstill | last post by:
hi- So I wrote this nice little page that will allow the managers to add images to the products table. Without too many details to confuse everything, basically what I'm doing is: getting an...
7
by: somequestion | last post by:
System.Drawing.Image newImage = Bitmap(....) newImage.Save(destinationPath, ImageFormat.Jpeg); this image resolution is very low i'd like to make high quality image so i change...
1
by: Daniel Mark | last post by:
hello all: I am using Image module from PIL to save created image as JPG format. Is there any option I could set for function Image.save so that the stored image will have the highest quality....
9
by: kombu67 | last post by:
I'm reading a series of images from a MS SQL table and saving them to directory. These are staff ID pictures from our security card app. Once I've extracted the ID photo from the security app to...
11
by: shapper | last post by:
Hello, I am displaying an image on a few pages. The image size is 50 px height and 50 px width. In some pages I need the image to be 30x30 px in others 40x40 px and in others 50x50px. Can I...
8
by: JJ | last post by:
Whilst I am resizing images I am losing quality. This is only happening in small amounts, but if you repeatedly put the same image through the following code, the image quality slowly degrades. Can...
1
by: Sinan Alkan | last post by:
Hi All, I have a method to resize any image file to the specific dimensions and save this new image to a path. I found it on a web page(By Joel Neubeck) and i changed it for my project. The...
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
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
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,...

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.