Image Quality problem

  • Thread starter Thread starter somequestion
  • Start date Start date
S

somequestion

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?
 
try using ImageFormat.Png format ,
its not perfect but better then jpg and not big as bmp or tiff.

ersin
 
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,EXIF and so on.
only JPEG format option make low image than original image.

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



System.Drawing.Image newImage newImage = new
Bitmap(targetImagePath);

newImage.Save(destinationPath, ImageFormat.Png);
 
You can set the quality of the image:

// Create parameters
EncoderParameters params = new EncoderParameters (1);

// Set quality (50)
params.Param[0] = new EncoderParameter (Encoder.Quality, 50);

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

// Save
image.Save (filename, codec, params);
 
You are right... rewritten:

// Create parameters
EncoderParameters params = new EncoderParameters (1);

// Set quality (50)
params.Param[0] = new EncoderParameter (Encoder.Quality, 50);

// Create encoder info
ImageCodecInfo codec = null;
foreach (ImageCodecInfo codectemp in ImageCodecInfo.GetImageDecoders
())
if (codectemp.MimeType == "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
 
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+
 
it will be lower than png but may be enough high for him..who knows...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top