473,606 Members | 2,200 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 12402
When resizing the best you can do is use the HighQualityBili near or
HighQualityBicu bic 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@_spamkille r_bobpowell.net > wrote in message
news:#r******** ******@TK2MSFTN GP10.phx.gbl...
When resizing the best you can do is use the HighQualityBili near or
HighQualityBicu bic 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.From Image(bm);

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

g.Interpolation Mode=Interpolat ionMode.HighQua lityBilinear;

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

g.DrawImage(old Image,new
Rectangle(0,0,o ldImage.Width,o ldImage.Height) ,0,0,bm.Width,
bm.Height,Graph icsUnit.Pixel);
g.Dispose();

Now save the image...

oldImage.Dispos e();
bm.Save(filenam e,ImageFormat.b mp);

--
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*********@jo hannsen.us> wrote in message
news:d%******** *******@newssvr 14.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@_spamkille r_bobpowell.net > wrote in message
news:#r******** ******@TK2MSFTN GP10.phx.gbl...
When resizing the best you can do is use the HighQualityBili near or
HighQualityBicu bic 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
2157
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 what the image looks like, and how big it is. the quality is selected using a trackBar1. the MouseUp event of trackBar1 triggers this method public void updatePanel() string file =...
5
10018
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 the
6
2483
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 2000 server. The quality of the small thumbnail is ok, but the quality of the larger image is terrible. I tried both Jpeg and Gif formats and there is no difference.
6
1922
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 Image from there I'm creating a new Bitmap(Image, int w, int h); then I'm saving that bitmap various encoder quality values.
7
2193
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 ImageFormat.Bmp or Tiff but it too big....maybe more than 10 times of original image my goal is low image size and high quality....how can i do?
1
4759
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. Thank you
9
9609
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 disk, I need to reference the disk file in our HR app. As part of the process, I'm resizing the image and changing its resolution from 96 to 72 dpi. If they are not at a 72 dpi resolution, the HR app freezes. The resizing works without a hitch, but...
11
5809
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 scale the image using CSS? Thanks,
8
2374
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 anyone spot why this may be happening? Should it only deteriate once upon intitially going through this procedure? The deterioration is subtle, but after a few iterations is quite noticeable..: private static System.Drawing.Image...
1
2143
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 code is as follows; --------------------------------- // usings part using System.Drawing; using System.Drawing.Imaging;
0
8015
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
7951
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
8439
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...
0
6770
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
5465
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
3930
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3977
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2448
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
1
1553
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.