Announcement

#1 2018-03-21 16:45:13

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Color Palette

Hello aNNiMON,

I'm currently testing your plugin [extension by aNNiMON] Color Palette and I would like to tell you it's great :-)

Can you describe how it works? What make a color considered as "dominant" ? On some examples I have unexpected results. Maybe I would understand if you explain the general algorithm :-)

Also I suggest you add a prefilter "without color palette" in the batch manager.

Cheers,

Offline

 

#2 2018-03-21 18:12:23

aNNiMON
Member
2018-02-10
5

Re: Color Palette

Thank you so much for feedback. I'll add "without color palette" prefilter in a short time.

There is a predefined palette with 67 colors. The extension reads the pixel, looks for the closest color from this palette and increments the number of occurrences of color. Then returns the required number of the most common colors.

To speed up palette generation, the extension read pixels with a certain step. This can be set in the settings, the "Sample image size" parameter (I think it's easier for the user, rather than "Step" parameter). For example, if image 6000x4000, sample size = 150px, we need about 150*150=22500 pixels to generate palette, so the step will be 32px. (6000/32)*(4000/32)=23437 pixels to read.

If you need more accurate generation of the palette, just increase "Sample image size" parameter.

Offline

 

#3 2018-03-31 17:52:13

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: Color Palette

Thank you for explaining :-)

I suggest you make the configuration easier to use with sliders:

* Number of colors : 3 to 16
* Sample image size : 50 to 400 (with steps of 50)

You can see on plugin Community how I used sliders.

And also, for a matter of design, have a tab. Even if you have only one tab, it's better to have it.

Offline

 

#4 2018-03-31 17:53:17

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13791

Re: Color Palette

Other thing, on such photo, I would expect to see the pink in the color palette.

http://piwigo.org/forum/showimage.php?pid=170403&filename=color-palette-unexpected-result.png

Offline

 

#5 2018-03-31 18:52:09

aNNiMON
Member
2018-02-10
5

Re: Color Palette

Thanks, I forgot about sliders. I'll add them in next update.
Understood about tab, I'll add it too.

As for your image, unfortunately the background is dominated by pale tones that are close to gray shades. Pink color is also present in the palette, but with lesser number of occurences and since you're limit palette to 3 colors, pink isn't entered as result.
I recommend to use at least 5 colors in palette for a better result.

Or I could decrease amount of gray colors in predefined palette, but it would cause another problem - a color palette will be generated for grayscale images. For example, number of colors in settings is 8, predefined palette has 3 colors and resulting palette will contain 3 gray and 5 other colors that are not exists in image.

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact