dynamically generated image's quality

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);
 
B

billmiami2

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
 
E

Ersin Gençtürk

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.
 
K

Kevin Spencer

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.
 
B

billmiami2

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
 

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

Members online

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top