bit-bots / imagetagger

An open source online platform for collaborative image labeling
MIT License
267 stars 54 forks source link

Image scale not calculated until the image is resized #57

Closed jquinn57 closed 6 years ago

jquinn57 commented 6 years ago

It seems that the when images are resized to fit into the window, the scale factor for the annotations sometimes does not match the image scale factor, so the boxes appear in the wrong place and are the wrong size. I have noticed when the window is resized then the scale factor is recomputed and then the boxes go to the correct location.
A simple solution to this is to add a call to calculateImageScale() on line 288 of imagetagger/imagetagger/annotations/static/js/annotations.js so that the image scale is always computed right before drawing the boxes. I have seen this problem occur in Firefox and Chrome. I am working with large images which are scaled down to fit in the window.

Daniel451 commented 6 years ago

@NFiedler is this reproducible? That would be a major bug.

NFiedler commented 6 years ago

I could reproduce the problem and the proposed fix works. I am not sure whether there is a more elegant solution which only calculates the scale when the image actually changes. But for now... it works. Thank you very much for your contribution @jquinn57 !