Round when converting to 8 bits (#3429)
This commit is contained in:
@@ -335,9 +335,9 @@ Imagefloat::to8()
|
||||
|
||||
for (int h = 0; h < height; ++h) {
|
||||
for (int w = 0; w < width; ++w) {
|
||||
img8->r(h, w) = static_cast<unsigned short>(r(h, w)) / 257;
|
||||
img8->g(h, w) = static_cast<unsigned short>(g(h, w)) / 257;
|
||||
img8->b(h, w) = static_cast<unsigned short>(b(h, w)) / 257;
|
||||
img8->r(h, w) = (static_cast<unsigned int>(r(h, w)) + 128) / 257;
|
||||
img8->g(h, w) = (static_cast<unsigned int>(g(h, w)) + 128) / 257;
|
||||
img8->b(h, w) = (static_cast<unsigned int>(b(h, w)) + 128) / 257;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user