Does anyone have an algorithm to reduce a 32bit color value to a 8bit (256) or a 4bit (16) and/or a 2bit (4 color) value
I don’t know if it can reasonable be done based on just the COLOR value, or if it needs to analyze surrounding color pixels in the image…
But basically I need to take a PICTURE object and quickly reduce the color count while retaining the “best” looking result.
I was using QTExporter to do this for me. but since that is not an option any more I need to be able to replace that functionality
This will reduce to 2-256 colors with a quality parameter where higher quality takes more time. The output picture I believe is 24bit using the reduced colors, but the color table is supplied if you want to scan into a different picture. http://home.comcast.net/~trochoid/code/NeuroQuant4d.zip
Well you know my positon on plugins… I’d prefer the minimal amount of code (such as declares)…
really don’t want to link a huge library such as MacOSLib… even though I realize the compiler supposedly only links what is necessary
I use Transform quite a lot in this application… it is great for inverting colors, changing brightness, contrast…
but to reduce a colormap would require building a transform map which is 99% of the work
Unless you have an idea in that regard that I’m not seeing
And Declares would be fine… just do not wish Plugins for reasons I have stated before. At least with a Declare I can research what it is how it works, and have a possiblty of replacing it in the future should Apple deprecate the current one
Ok… I am assuming that because you recommended MacOSLib that you thought such a feature example was in there… but if it is I am failing to recognize it as such. I saw some stuff that looked promising, but it was Carbon code… seems the level of comment/explanation is a bit on the short side…
Doesnt the picture class do the job correctly? You can create a new picture with a given depth (0, 1, 2, 4, 8, 16 or 32 pixels) and then copy the source image to it. Havent tried myself, so I am unsure about the quality
Are you sure?
Most depths below 32 seem to fail for me on Mac these days. I gave up and made everything 32bit to shut it up, (even though in many cases for my needs, I only needed 2 bit images… sharp masks being a good case in point)