16 Color Image Quantization
16 Color Image Quantization
16 Color Image Quantization
16 Color Image Quantization
16 Color Image Quantization
16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization
16 Color Image Quantization 16 Color Image Quantization
16 Color Image Quantization
Go Back  Xtreme Visual Basic Talk > > > 16 Color Image Quantization


Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2004, 04:39 PM
dgfjslfsgjd dgfjslfsgjd is offline
Newcomer
 
Join Date: Dec 2003
Posts: 5
Default 16 Color Image Quantization


Hi , when i use onerror's quantization example for gdi+ (Color Quantization and GDI+ GIF with much better quality) when converting a 24 bpp image to 4 bpp, the results only give me 15 colors. so there's one color left over it could have used. is there a way to improve quantization, so that all 16 colors are fully utilized?
Reply With Quote
  #2  
Old 04-08-2004, 08:45 PM
passel's Avatar
passel16 Color Image Quantization passel is offline
Sinecure Expert

Super Moderator
* Guru *
 
Join Date: Jun 2003
Location: Upstate New York, usa
Posts: 8,026
Default

Did you count black as one of the colors?
__________________
There Is An Island Of Opportunity In The Middle of Every Difficulty.
Miss That, Though, And You're Pretty Much Doomed.
Reply With Quote
  #3  
Old 04-08-2004, 10:07 PM
dgfjslfsgjd dgfjslfsgjd is offline
Newcomer
 
Join Date: Dec 2003
Posts: 5
Default

yeah i counted black, and any other transparant/background color as a color =)
there are also way more than 16 colors in the source image too
Reply With Quote
  #4  
Old 05-30-2004, 03:22 AM
dgfjslfsgjd dgfjslfsgjd is offline
Newcomer
 
Join Date: Dec 2003
Posts: 5
Default

* bump*
Reply With Quote
  #5  
Old 05-30-2004, 04:03 AM
Mathijsken's Avatar
Mathijsken Mathijsken is offline
Contributor
 
Join Date: May 2003
Location: Oostkamp - Belgium
Posts: 730
Default

Maybe you should PM OnError about it, he might explain it as it is his code...

Mathijsken
__________________
Fear is the first step towards intolerance.
Reply With Quote
  #6  
Old 05-30-2004, 09:49 AM
OnErr0r's Avatar
OnErr0r16 Color Image Quantization OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

Post the original image and I'll take a look.
Reply With Quote
  #7  
Old 06-02-2004, 01:13 AM
dgfjslfsgjd dgfjslfsgjd is offline
Newcomer
 
Join Date: Dec 2003
Posts: 5
Default

Quote:
Originally Posted by OnErr0r
Post the original image and I'll take a look.
Aright

- These two pics convert to 14 colors when the depth setting is set to quantitize to 16 colors
http://devster.retrodev.com/pub/p3010088.jpg
http://devster.retrodev.com/pub/p3010096.jpg

- This one converts to 15 colors
http://devster.retrodev.com/pub/p3010093.jpg

Some images convert to the full 16 colors, and some don't. I tried setting the depth to 17 to 20 to get the full 16 colors out of these images, but it sometimes doesn't work, and would give me more colors than i need.

I used your gdi3 example, and i did the "last missing line" addition, but i don't think that would affect quantization quality at all, maybe =)

thanx lots!
Reply With Quote
  #8  
Old 06-02-2004, 01:10 PM
OnErr0r's Avatar
OnErr0r16 Color Image Quantization OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,774
Default

The problem is with the OCTree data structure, which has up to 8 child nodes per node. When the CombineNodes function is called (to reduce the number of nodes/colors in the palette) it can find from 1 to 8 child nodes to reduce. This leads to a decrease of 0 to 7 colors. So, if you specify Quantize 16, you may have a palette returned with from 9 to 16 colors.

One way around this problem might be to use the quantize code supplied, and add seven to the number of palette colors you need. Then, if the number of colors returned is greater than are needed, you pass the palette to another function which could quantize out (by averaging) the closest remaining colors until the desired quantity is reached.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Color Quantization and GDI+ GIF with much better quality OnErr0r Code Library 4 12-21-2005 11:49 AM
Color Quantization and GDI+ GIF with much better quality OnErr0r Code Library 0 12-16-2003 05:25 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
16 Color Image Quantization
16 Color Image Quantization
16 Color Image Quantization 16 Color Image Quantization
16 Color Image Quantization
16 Color Image Quantization
16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization 16 Color Image Quantization
16 Color Image Quantization
16 Color Image Quantization
 
16 Color Image Quantization
16 Color Image Quantization
 
-->