Группа :: Графика
Пакет: netpbm
Главная Изменения Спек Патчи Загрузить Bugs and FR
Патч: netpbm-10.25-bmpbpp.patch
--- netpbm-10.25/converter/ppm/ppmtobmp.c.bmpbpp 2004-03-13 20:37:32.000000000 +0100
+++ netpbm-10.25/converter/ppm/ppmtobmp.c 2004-10-18 12:23:43.762552192 +0200
@@ -509,6 +509,25 @@ analyze_colors(const pixel ** const p
} else {
*minimum_bpp_p = pm_maxvaltobits(*colors_p-1);
pm_message("%d colors found", *colors_p);
+
+ {
+ int bpps[] = {1,4,8,24,0};
+ int i;
+
+ for (i = 0; bpps[i] && bpps[i] != *minimum_bpp_p; i++);
+
+ if (!bpps[i]) {
+ for (i = 0; bpps[i]; i++)
+ if (*colors_p-1 < (1<<bpps[i])) break;
+
+ /*
+ * If the *minimum_bpp_p is > 24 bpp leave it as is
+ */
+ if (bpps[i])
+ *minimum_bpp_p = bpps[i];
+ }
+ }
+
/*
* Now scale the maxval to 255 as required by BMP format.
*/