473,568 Members | 2,905 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 1755
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*****@hotmai l.com> wrote in message
news:#X******** ******@TK2MSFTN GP12.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
2155
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 what the image looks like, and how big it is. the quality is selected using a trackBar1. the MouseUp event of trackBar1 triggers this method public...
2
3073
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 rotate/flip a graphic in .NET *without* data loss. If so, how? If not, why? I understand that when *resizing* a graphic, some degradation in the...
2
2918
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 degrades the image quality of the JPEG. I am using SetPropertyItem to change the tag value and then calling the Save method to save the JPEG under a...
6
1921
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 Image from there I'm creating a new Bitmap(Image, int w, int h); then I'm saving that bitmap various encoder quality values.
4
1384
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 with everything is set to fine also gives me low quality ? how can I set the quality to the maximum ? What is wrong here ?
6
3484
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 --> Save) in MS Photo Editor, the file is automatically shrunk in size to 81 KB's. When doing the same thing in MS Paint, the file is shrunk to 54...
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,...
1
2134
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;
3
3569
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 little website: 1. Small: DOWNsize of original image to be used as a thumbnail. 2. Medium: DOWNsize of original image to be used as user...
0
7605
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...
0
7917
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7665
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...
0
7962
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...
0
6277
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5501
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
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...

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.