Visdom: Scale images to window size?

Created on 22 Jun 2018  路  3Comments  路  Source: fossasia/visdom

When plotting small images with Visdom.image, it would be nice if the image resized to fit its window (and/or have zoom widgets) since small (32x32) images are pretty hard to see on a 4k display if there's a 1-to-1 correspondence between display pixel and image pixel.

enhancement help wanted

Most helpful comment

Hi @malmaud - we actually do have zoom (ctrl-scroll or pinch controls) on image windows currently, however fitting the image to the window on resize would be pretty cool to have as well. Will investigate.

All 3 comments

Hi @malmaud - we actually do have zoom (ctrl-scroll or pinch controls) on image windows currently, however fitting the image to the window on resize would be pretty cool to have as well. Will investigate.

A quick note to anyone who is interested in implementing this - the fix relies on altering scale similarly to how it's done:
https://github.com/facebookresearch/visdom/blob/f340284d5e5671908f3645139b3385d1a2585913/js/ImagePane.js#L17
but specifically when the h or w props change. You'll need to query the height and width of the image itself directly from the source (which is often done by prepping a dummy image component and getting its size, but never rendering it).

This was implemented in #657. Thanks @ml7

Was this page helpful?
0 / 5 - 0 ratings