MZ How do I get the width and height of a picture as a variable?

How do I get the width and height of a picture as a variable?
This sort of thing seems to work for me (picture ID 1):
JavaScript:
SceneManager._scene._spriteset._pictureContainer.children[0].width
  • For picture ID 2, replace 0 with 1, etc.
  • For height, replace width with height.
This assumes the picture is already loaded and visible in-game. By default the Show Picture command waits for images to load before proceeding ("image" interpreter wait mode), so in that case, there's no problem.
  • For picture ID 2, replace 0 with 1, etc.
  • For height, replace width with height.
This assumes the picture is already loaded and visible in-game. By default the Show Picture command waits for images to load before proceeding ("image" interpreter wait mode), so in that case, there's no problem.
Thank you very much caethyril!

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-get-the-width-and-height-of-a-picture-as-a-variable.152575/