473,594 Members | 2,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.For mat24bppRgb);

//some stuff here drawing picture

//saving the picture

ImageCodecInfo[] icf = ImageCodecInfo. GetImageEncoder s();

EncoderParamete rs encps = new EncoderParamete rs( 1 );

EncoderParamete r encp = new EncoderParamete r(
System.Drawing. Imaging.Encoder .Quality,

(int)99 );

encps.Param[0] = encp;

pic.Save(Respon se.OutputStream ,icf[2],encps);
Nov 19 '05 #1
4 1384
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********@net scape.net> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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******** *******@TK2MSFT NGP12.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********@net scape.net> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.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
1420
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 doesn't seem to work. Here's how it's setup. The Image control has URL property "image.aspx". The Page_Load method of image.aspx contains the code
1
5818
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 doesn't seem to work. Here's how it's setup. The Image control has URL property "image.aspx". The Page_Load method of image.aspx contains the code
6
2481
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.
2
1259
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: http://dotnet.kensho.dk/scr_diagram.aspx?tal=12&jeg=3&fan=9&san=3&soc=7&kon=2&int=12&fol=5&img=gif http://dotnet.kensho.dk/scr_diagram.aspx?tal=12&jeg=3&fan=9&san=3&soc=7&kon=2&int=12&fol=5&img=jpg I would very much like to have clearer images, but I haven't been able to locate a property...
8
2338
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
9608
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...
11
5809
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 scale the image using CSS? Thanks,
8
2373
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 anyone spot why this may be happening? Should it only deteriate once upon intitially going through this procedure? The deterioration is subtle, but after a few iterations is quite noticeable..: private static System.Drawing.Image...
1
2141
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
7876
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
8372
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
8003
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,...
0
8234
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
3859
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
3897
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2385
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1478
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1210
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.