My question is, will this work the same way on other operating systems and browsers?
The short answer is no. For example, Internet Explorer determines how to decode images based upon the file extension.
If you'd like to do a test for how things work in other browsers, make a simple test HTML page which shows the various images as you described, put them online, and then try viewing them here:
https://developer.microsoft.com/en-us/microsoft-edge/tools/screenshots/
That will show you what the first page of your HTML page looks like when rendered through different browsers on different operating systems.
In any case, because IE doesn't support what you're trying to do, and the fact that roughly 1 in 20 people in the US still use IE (unfortunately):
http://gs.statcounter.com/browser-market-share/all/united-states-of-america
I would strongly recommend against renaming the file extensions.
That is, unless you want a bunch of people asking you why images don't work for them. :-P
If all of your filenames are unique, even once the file extension is ignored, then you could just make a lookup table if you really need to. Something like:
<<set setup.img = { picture1: ".jpg", picture2: ".gif", house: ".jpg", symbol: ".png", etc... }>>
And that should help add the correct file extension like this:
<<set _fnam = "picture" + _n>>
<<set _fnam += setup.img[_fnam]>>
Hope that helps! :-)