473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

dynamically generated image's quality

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);
Nov 19 '05 #1
4 1370
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

Nov 19 '05 #2
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.

<bi********@netscape.net> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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

Nov 19 '05 #3
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 Gençtürk" <ers[spam]@gencturk.org> wrote in message
news:O6***************@TK2MSFTNGP12.phx.gbl...
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.

<bi********@netscape.net> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
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


Nov 19 '05 #4
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

Nov 19 '05 #5

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

Similar topics

0
by: Chris Jones | last post by:
I am creating a web page that dynamically generates an image, which is placed in an Image control. Everything works fine for .gif and .jpeg files. I would prefer using .png format, but that...
1
by: Chris Jones | last post by:
I am creating a web page that dynamically generates an image, which is placed in an Image control. Everything works fine for .gif and .jpeg files. I would prefer using .png format, but that...
6
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...
2
by: Kim Bach Petersen | last post by:
Using asp.net, I'm generating bitmaps, that I stream either as gif- og jpg-images (se code below). In both cases, the image-quality is rather poor: ...
8
by: miladhatam | last post by:
can i change the size of a file dynamically ? for example have 100 Kb and i want to decrease it to 20 Kb thanks
9
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...
11
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...
8
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...
1
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
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...
0
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,...

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.