473,805 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Image Quality problem

System.Drawing. Image newImage = Bitmap(....)

newImage.Save(d estinationPath, ImageFormat.Jpe g);

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?

Nov 19 '05 #1
7 2201
try using ImageFormat.Png format ,
its not perfect but better then jpg and not big as bmp or tiff.

ersin
"somequesti on" <so**********@g mail.com> wrote in message
news:eN******** *****@TK2MSFTNG P11.phx.gbl...
System.Drawing. Image newImage = Bitmap(....)

newImage.Save(d estinationPath, ImageFormat.Jpe g);

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?

Nov 19 '05 #2
You can set the quality of the image:

// Create parameters
EncoderParamete rs params = new EncoderParamete rs (1);

// Set quality (50)
params.Param[0] = new EncoderParamete r (Encoder.Qualit y, 50);

// Create encoder info
ImageCodecInfo codec = GetEncoderInfo( "image/jpeg");

// Save
image.Save (filename, codec, params);

--

Juan C. Olivares
www.juancri.com

Nov 19 '05 #3
thanks for reply

the test of result is png image created 6 times bigger than original image
i've already have tested all of ImageFormat option such as
JPEG,TIFF,BMP,E XIF and so on.
only JPEG format option make low image than original image.

i guss there is any way changing JPEG Quality. ..
for example...Inter polationMode
can i apply this method in my code ...?

System.Drawing. Image newImage newImage = new
Bitmap(targetIm agePath);

newImage.Save(d estinationPath, ImageFormat.Png );

"Ersin Gen??k" <ers[spam]@gencturk.org> wrote in message
news:uT******** ******@tk2msftn gp13.phx.gbl...
try using ImageFormat.Png format ,
its not perfect but better then jpg and not big as bmp or tiff.

ersin
"somequesti on" <so**********@g mail.com> wrote in message
news:eN******** *****@TK2MSFTNG P11.phx.gbl...
System.Drawing. Image newImage = Bitmap(....)

newImage.Save(d estinationPath, ImageFormat.Jpe g);

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?


Nov 19 '05 #4
There is no GetEncoderInfo. ...
"JuanCri" <ju*****@gmail. com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
You can set the quality of the image:

// Create parameters
EncoderParamete rs params = new EncoderParamete rs (1);

// Set quality (50)
params.Param[0] = new EncoderParamete r (Encoder.Qualit y, 50);

// Create encoder info
ImageCodecInfo codec = GetEncoderInfo( "image/jpeg");

// Save
image.Save (filename, codec, params);

--

Juan C. Olivares
www.juancri.com

Nov 19 '05 #5
You are right... rewritten:

// Create parameters
EncoderParamete rs params = new EncoderParamete rs (1);

// Set quality (50)
params.Param[0] = new EncoderParamete r (Encoder.Qualit y, 50);

// Create encoder info
ImageCodecInfo codec = null;
foreach (ImageCodecInfo codectemp in ImageCodecInfo. GetImageDecoder s
())
if (codectemp.Mime Type == "image/jpeg")
codec = codectemp;

// Check
if (codec == null)
throw new Exception ("Codec not found for image/jpeg");

// Save
image.Save (filename, codec, params);

Juan C. Olivares
www.juancri.com

Nov 19 '05 #6
Juan , even if you set the image quality 99 with encoder params , qualitiy
will be still lower then png's because of the jpg encoding engine in gdi+
"JuanCri" <ju*****@gmail. com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
You are right... rewritten:

// Create parameters
EncoderParamete rs params = new EncoderParamete rs (1);

// Set quality (50)
params.Param[0] = new EncoderParamete r (Encoder.Qualit y, 50);

// Create encoder info
ImageCodecInfo codec = null;
foreach (ImageCodecInfo codectemp in ImageCodecInfo. GetImageDecoder s
())
if (codectemp.Mime Type == "image/jpeg")
codec = codectemp;

// Check
if (codec == null)
throw new Exception ("Codec not found for image/jpeg");

// Save
image.Save (filename, codec, params);

Juan C. Olivares
www.juancri.com

Nov 19 '05 #7
it will be lower than png but may be enough high for him..who knows...

Nov 19 '05 #8

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

Similar topics

2
2941
by: Travis | last post by:
Hi everyone, I'm using the System.Drawing.Imaging.Bitmap to retrieve and modify the metadata tags (user comments, keywords etc) of JPEGS. I was wondering if changing these tags in any way degrades the image quality of the JPEG. I am using SetPropertyItem to change the tag value and then calling the Save method to save the JPEG under a different name (you have to do this because GDI holds a lock on the original file).... If there is...
5
10032
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
2508
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
1931
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.
4
1398
by: Steve Peterson | last post by:
Hi I've been beating my head against the wall trying to get this done, with little to no success so I thought I would turn to the .Net community for some help. I have an .NET app in which the user can upload an image file. What I need to do is take the image and save it in a scale it to a preset size (for example an image origanally 640X480 to 320X240 or 50% of original size). Doing the math to get the correct new width & height is no...
4
3822
by: Greg | last post by:
I've searched everywhere for a solution Microsoft .NET Framework V 2.0.50727 AutoEventWireup="false" image2.aspx resize an image on the fly but Page_Load is triggered twice: Any suggestion? Here is the code behind:
8
3693
by: berkshire | last post by:
Hi, Anyone know of a script out there that can resize images and not sacrifice image quality? I've been using phpthumb (http://phpthumb.sourceforge.net/) but when compared to an image resized in photoshop it's products are not as good (yeah I upped the image quality and tried out some filters - no luck). Tutorials or scripts online preferred are preferred, but if you know of a way to change the settings on phpthumb to maintain the...
9
9657
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...
1
2150
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
9596
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
10613
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
10363
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10368
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,...
1
7649
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
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
5544
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
5678
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3846
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.