How can i posterizes an image with results identical to Gimp's Posterize command? i've written the following code which make posterize with value 5, but it doesn't work correctly, cause the result image is not an identical to gimp's posterize tool at 5 value. it differs a little when i increase scale to 400% and look at result image and the image after gimp's posterize... any idea?
for(int x=0; x<image.width(); x++)
for(int y=0; y<image.height(); y++)
result.setPixel(x, y, 51+51*(int)(qGray(image.pixel(x, y))/51));
for(int x=0; x<image.width(); x++)
for(int y=0; y<image.height(); y++)
result.setPixel(x, y, 51+51*(int)(qGray(image.pixel(x, y))/51));
To copy to clipboard, switch view to plain text mode
PS: Posterize - it's reduce number of colors (is available, for ex., in GIMP at "Colors -> Posterize...")
Bookmarks