but mostly it is cast directly to int.
Currently it can return an int or float depending on the input type, but the number is always equal to an integer because it uses integer division.
So, check if we need to use ceil() or round() (from Python 2 days) or if we can just return an int.
Then, we could cast the input to float(pixels).
Sometimes we rely on it returning an int, e.g. this is used for scalebars:
width = scale_to_export_dpi(width)
for l in range(width):
draw.line([(x, y), (x2, y2)], fill=rgb)
See https://github.com/ome/omero-figure/pull/409
Sometimes the output of
scale_to_export_dpi()
is rounded up, or down:but mostly it is cast directly to
int
. Currently it can return anint
orfloat
depending on the input type, but the number is always equal to an integer because it uses integer division. So, check if we need to useceil() or round()
(from Python 2 days) or if we can just return anint
. Then, we could cast the input tofloat(pixels)
.Sometimes we rely on it returning an
int
, e.g. this is used for scalebars:cc @emilroz