### Bookstore

 Computer Math and Games in Pascal (preview) Lazarus Handbook

### Recent

#### stab

• Full Member
• Posts: 234
« on: January 07, 2022, 04:53:10 pm »
Hi,

Am trying to make a program to extract elevation curves from a topographical map and need to reduce image colors. Would like to use TBGRAColorQuantizer but can't figure out how to use it and especially determine number of colors for a reduced image.
Is there some more comprehensive tutorial on how to use TBGRAColorQuantizer

Thanks in advance for any help

stab
« Last Edit: January 07, 2022, 04:55:56 pm by stab »

#### winni

• Hero Member
• Posts: 3045
« Reply #1 on: January 08, 2022, 12:49:06 pm »

#### circular

• Hero Member
• Posts: 3794
« Reply #2 on: January 08, 2022, 10:10:48 pm »
Not sure what you mean by "determine number of colors for a reduced image"?
Conscience is the debugger of the mind

#### stab

• Full Member
• Posts: 234
« Reply #3 on: January 10, 2022, 11:09:27 am »
Hi,

Looking at posts regarding your quantizer, I got the impression that it  reduced to a determined amount of colors i.e 256 colors. In my ambition to extract elevation curves, mentioned in my first post, I think I might need to try different numbers of colors in the resultant image. Have read your tutorials on BGRABitmap(excellant), but about the quantizer I didn't find too much. Perhaps I'm just too stupid to understand how to use it to it's full potential.

#### circular

• Hero Member
• Posts: 3794
« Reply #4 on: January 29, 2022, 12:40:26 pm »
Hello again,

You can change the number of colors to be used by accessing ReductionColorCount of the quantizer object. Thus try different values.

You can know the number of colors in the original image with the SourceColorCount property.

Conscience is the debugger of the mind

#### stab

• Full Member
• Posts: 234
« Reply #5 on: January 29, 2022, 02:07:03 pm »
Thank your, I think that will let me do what I'm trying to achieve

#### winni

• Hero Member
• Posts: 3045
« Reply #6 on: January 29, 2022, 03:32:12 pm »
Hi!

It creates a HSL gradient and reduce it to 8 x 8 x 8 = 512 Colors.

Project and screenshot attached

Winni

• Full Member
• Posts: 234