JSFiddle - React, Tailwind, and code Playground

HTML

<img width="100" height="200" title="Vertical" />
<img width="200" height="200" title="Quadrada" />
<img width="200" height="100" title="Horizontal" />
<img width="200" height="100" title="Horizontal" />
<img width="100" height="200" title="Vertical" />

JavaScript

// JS puro
var imgs = document.getElementsByTagName("img");

for (var i = 0; i < imgs.length; i++)
{
    if (imgs[i].width < imgs[i].height)
    {
        alert(imgs[i].title);
    }
}

// Usando jQuery
$("img").each(function()
{
    if (this.width < this.height)
    {
        alert(this.title);
    }
});