Commit c6c6cf69f5ebefa11a157e29a367a6be4cc5d36f
1 parent
a8c8f400
ratio should be a float
Showing
1 changed file
with
2 additions
and
2 deletions
scripts/brpy/html_viz.py
| @@ -18,7 +18,7 @@ def crop_to_bb(x, y, width, height, imname, maxheight=None): | @@ -18,7 +18,7 @@ def crop_to_bb(x, y, width, height, imname, maxheight=None): | ||
| 18 | imwidth, imheight = img.size | 18 | imwidth, imheight = img.size |
| 19 | if not maxheight: | 19 | if not maxheight: |
| 20 | maxheight = height | 20 | maxheight = height |
| 21 | - ratio = maxheight / height | 21 | + ratio = float(maxheight) / height |
| 22 | # note for future me: | 22 | # note for future me: |
| 23 | # image is cropped with div width/height + overflow:hidden, | 23 | # image is cropped with div width/height + overflow:hidden, |
| 24 | # resized with img height, | 24 | # resized with img height, |
| @@ -37,7 +37,7 @@ def bbs_for_image(imname, bbs, maxheight=None, colors=None): | @@ -37,7 +37,7 @@ def bbs_for_image(imname, bbs, maxheight=None, colors=None): | ||
| 37 | imwidth, imheight = img.size | 37 | imwidth, imheight = img.size |
| 38 | if not maxheight: | 38 | if not maxheight: |
| 39 | maxheight = imheight | 39 | maxheight = imheight |
| 40 | - ratio = maxheight/imheight | 40 | + ratio = float(maxheight)/imheight |
| 41 | html = [ | 41 | html = [ |
| 42 | '<div style="position:relative">', | 42 | '<div style="position:relative">', |
| 43 | '<img src="%s" style="height:%ipx" />' % (imname, maxheight) | 43 | '<img src="%s" style="height:%ipx" />' % (imname, maxheight) |