Monitor size

Hi everyone, I would like to ask if anyone knows how to extrapolate the value of the monitor size, not the resolution, the physical size of the monitor (in inches). I've searched a bit on the web but can't find anything.

I would like to create a command to disable "Graphics._stretch" from small monitors like Rog Ally and SteamDeck.

Thanks
Edit: I'm wrong. It is possible through some method:

I would like to create a command to disable "Graphics._stretch" from small monitors like Rog Ally and SteamDeck.
Why not just put it into the options menu for the user to set it however it looks best on their device? That's what people who play computer games have done for decades.
Why not just put it into the options menu for the user to set it however it looks best on their device? That's what people who play computer games have done for decades.

Yes, I know, I've already set it up like this, but I was hoping there was a simple way to create a more immediate user experience.
There isn't a reliable way to do this precisely, but this should give you an approximation:

JavaScript:
/** Provides an approximation of the user's physical screen size, in inches*/
function computeDisplaySize() {
    let testDiv = document.createElement('div');
    testDiv.style = "height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;";
    window.document.body.appendChild(testDiv);
    var devicePixelRatio = window.devicePixelRatio || 1;
    var dpi_x = Math.round(testDiv.offsetWidth * devicePixelRatio);
    var dpi_y = Math.round(testDiv.offsetHeight * devicePixelRatio);
    testDiv.remove();
    return { width: screen.width / dpi_x, height: screen.height / dpi_y };
}

Edit: I'm wrong. It is possible through some method:
I love the sass of that website: "Most reliable way to determine physical screen size is by means of a ruler".
/** Provides an approximation of the user's physical screen size, in inches*/ function computeDisplaySize() { let testDiv = document.createElement('div'); testDiv.style = "height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"; window.document.body.appendChild(testDiv); var devicePixelRatio = window.devicePixelRatio || 1; var dpi_x = Math.round(testDiv.offsetWidth * devicePixelRatio); var dpi_y = Math.round(testDiv.offsetHeight * devicePixelRatio); testDiv.remove(); return { width: screen.width / dpi_x, height: screen.height / dpi_y }; }
Thank's i'll try

Original thread: https://forums.rpgmakerweb.com/threads/monitor-size.162302/