473,503 Members | 5,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GIF quality when saving from .net is bad...way to fix?

I have written an image upload/resize tool that then saves out the image as
either a JPG or GIF.

I got the JPG save working nicely, using a codec and setting the compression
to 90%.

However, I can't seem to manipulate the GIF using the same parameter. All my
GIFs appear to be using a restricted pallette (reduced windows system?) and
they all come out incredibly grainy. Is there away to change the color
pallet the GIF uses when saving? Ideally, I'd like it to be an adaptive
pallet of colors found in the image itself (similiar to how Macromedia
Fireworks saves images).

Google/MSDN turn up lots of tutorials on changing JPG quality in .net, but I
haven't found a single one on GIFs yet...

-Darrel
Nov 18 '05 #1
2 1752
If I remember right you have to set the Palete manually. You can capture the
original palete of the image
and assign it to your new image after manipulation, but you may still have
problems if you're
adding new colors.

There's an MSDN article that talks in some detail about this here:

http://msdn.microsoft.com/library/de...colorquant.asp

and there are number of related articles that talk about transparent GIFs
which deal with
this issue as well (custom paletes).
+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/weblog/
----------------------------------
Making waves on the Web
"darrel" <no*****@hotmail.com> wrote in message
news:#X**************@TK2MSFTNGP12.phx.gbl...
I have written an image upload/resize tool that then saves out the image as either a JPG or GIF.

I got the JPG save working nicely, using a codec and setting the compression to 90%.

However, I can't seem to manipulate the GIF using the same parameter. All my GIFs appear to be using a restricted pallette (reduced windows system?) and they all come out incredibly grainy. Is there away to change the color
pallet the GIF uses when saving? Ideally, I'd like it to be an adaptive
pallet of colors found in the image itself (similiar to how Macromedia
Fireworks saves images).

Google/MSDN turn up lots of tutorials on changing JPG quality in .net, but I haven't found a single one on GIFs yet...

-Darrel

Nov 18 '05 #2
> There's an MSDN article that talks in some detail about this here:

http://msdn.microsoft.com/library/de...colorquant.asp

Thanks, Rick. That's EXACTLY what I need. It's a bit over my head, but I'll
see if I can get it working. Thanks!

(And, hopefully, in Whidbey, they'll update the GIF portion of GDI to use an
adaptive pallet by default instead of the incredibly outdated web-safe
pallet ;o)

-Darrel
Nov 18 '05 #3

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

Similar topics

1
2144
by: Sean | last post by:
i am writing a class that visual demonstrates the result of changing the quality of a jpeg. the intention is to do this by saving the file and a selected quality, then reloading it to get an idea of...
2
3058
by: Cecil Windham | last post by:
I'm using the following code to rotate an image (jpeg or gif), and have discovered that there is a significant degradation in the quality of the photo. Just wondering if there is a way to...
2
2911
by: Travis | last post by:
Hi everyone, I'm using the System.Drawing.Imaging.Bitmap to retrieve and modify the metadata tags (user comments, keywords etc) of JPEGS. I was wondering if changing these tags in any way...
6
1919
by: neverstill | last post by:
hi- So I wrote this nice little page that will allow the managers to add images to the products table. Without too many details to confuse everything, basically what I'm doing is: getting an...
4
1373
by: Ersin Gençtürk | last post by:
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...
6
3480
by: NutsAboutVB | last post by:
Hello, I am a .NET programmer and I have a JPEG image file (from digital camera) of about 109 KB's in size, when I open it and save it (without making any alterations at all, just going to File...
8
2370
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
2124
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...
3
3560
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi! This discussion may help other programmers get a better idea of how to save uploaded images through a website. Why? Well currently, I save 3 versions of every uploaded image on my own...
0
7194
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,...
1
6976
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...
0
7449
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...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1495
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 ...
0
372
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...

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.