Note: You must be registered in order to post a reply. To register, click here. Registration is FREE!
T O P I C R E V I E W
yogiyang
Posted - Jun 09 2018 : 03:00:41 Hello,
I am trying to build a color palette from a 8bit image based on selected pixels.
How can I achieve this?
TIA
Yogi Yang
7 L A T E S T R E P L I E S (Newest First)
xequte
Posted - Jun 24 2018 : 22:46:45 Hi Yogi
The Palette demo uses AssignPalette, which shows all the colors of the image's palette, even those not being used. You need to use CalcImagePalette, to only get those in use.
Anyway, for v8.0.0 ready before the end of the week, I've added a parameter to AssignPalette to show only the used colors.
// Load images in native format
ImageEnView1.IO.NativePixelFormat := true;
with ImageEnView1.IO do
LoadFromFileAuto( ExecuteOpenDialog());
// if the bitmap is not 8 bit paletted then convert it
if ImageEnView1.IEBitmap.PixelFormat <> ie8p then
ImageEnView1.IEBitmap.PixelFormat := ie8p;
//Build the Palette
IEColorPalette1.AssignPalette( ImageEnView1 );
I also tried out: CalcImagePalette
But the result is the same.
TIA
Yogi Yang
xequte
Posted - Jun 12 2018 : 16:30:44 Please show me your code.
Thanks for the tip. I tried that but what I am getting is not acceptable.
The image that I am using for testing is attached here. In the attached image just select a small portion of the image like say the RED color square and generate a palette. It contains many colors and some of the colors are just not possible in a red color pixels.
TIA
Yogi Yang
xequte
Posted - Jun 10 2018 : 19:36:08 Hi Yogi
How about if you copy the selection to a bitmap and use CalcImagePalette: