I’ve been trying to round long float numbers like:

32.268907563;
32.268907563;
31.2396694215;
33.6206896552;
...

With no success so far. I tried math.ceil(x), math.floor(x) (although that would round up or down, which is not what I’m looking for) and round(x) which didn’t work either (still float numbers).

What could I do?

Code:

for i in widthRange:
    for j in heightRange:
        r, g, b = rgb_im.getpixel((i, j))
        h, s, v = colorsys.rgb_to_hsv(r/255.0, g/255.0, b/255.0)
        h = h * 360
        int(round(h))
        print(h)

15 Answers
15

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *