dynamically generated image's quality

  • Thread starter Thread starter Ersin Gençtürk
  • Start date Start date
E

Ersin Gençtürk

Hi ,

I am creating dynamic images (for example writing text into a bitmap) and
saving it to the output stream with gdi library in .net but I can't adjust
image quality.

The best parameters with everything is set to fine also gives me low quality
? how can I set the quality to the maximum ? What is wrong here ?



Bitmap pic = new Bitmap(width, height, PixelFormat.Format24bppRgb);

//some stuff here drawing picture

//saving the picture

ImageCodecInfo[] icf = ImageCodecInfo.GetImageEncoders();

EncoderParameters encps = new EncoderParameters( 1 );

EncoderParameter encp = new EncoderParameter(
System.Drawing.Imaging.Encoder.Quality,

(int)99 );

encps.Param[0] = encp;

pic.Save(Response.OutputStream,icf[2],encps);
 
Your code looks OK.

I've been able to get nice quality images with jpegs. When I do so, I
set the encoder quality to 100L and ColorDepth to 24L. However, I
really can't say how well this would work (or even if it's appropriate)
for a bitmap image. I get decent images for gifs, but I can't remember
whether playing with the encoder settings actually made a tremendous
difference with gif images.

Bill E
 
I am generating jpeg outputs.but even it is set to best quality, not really
the best quality of the jpeg.I can see the compression very clearly when all
the attributes set to maximum.I am drawing black text on a white background
so It is more visible.
 
The problem is, you're not seting the compression. Therefore, it is using
the default.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
What You Seek Is What You Get.
 
Ersin,

I can't say if you're getting better or worse quality than I. Perhaps
we should trade jpg images to see. I'm sending you (to the address
shown on your newsgroup post) some jpg and emf images that I produced
with a .NET charting tool that I made. Take a look and see if they're
any better or worse than the ones you're producing. I know that the
jpg images were not very good when printed but looked good on the
screen. I think that the emf files print fairly well. These are the
best quality images that I've been able to produce so if they're no
better than yours than I can't really help you.

Bill
 
Back
Top