hextree - avoid quantizing images with less than 3 pixels (hextree implementation requirement)
This commit is contained in:
parent
a4cd4821a0
commit
8db68fc5e3
1 changed files with 33 additions and 28 deletions
|
@ -654,7 +654,8 @@ void save_as_png8_hex(T1 & file,
|
|||
{
|
||||
unsigned width = image.width();
|
||||
unsigned height = image.height();
|
||||
|
||||
if (width + height > 3) // at least 3 pixels (hextree implementation requirement)
|
||||
{
|
||||
// structure for color quantization
|
||||
hextree<mapnik::rgba> tree(opts.colors);
|
||||
if (opts.trans_mode >= 0)
|
||||
|
@ -686,8 +687,12 @@ void save_as_png8_hex(T1 & file,
|
|||
palette.push_back(rgb(pal[i].r, pal[i].g, pal[i].b));
|
||||
alphaTable.push_back(pal[i].a);
|
||||
}
|
||||
|
||||
save_as_png8<T1, T2, hextree<mapnik::rgba> >(file, image, tree, palette, alphaTable, opts);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error("Can't quantize images with less than 3 pixels");
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T1, typename T2>
|
||||
|
|
Loading…
Add table
Reference in a new issue