JSFiddle - React, Tailwind, and code Playground
HTML
<div class="myDiv">
</div>
CSS
.myDiv {
height: 270px;
background-image: url(https://cs.dotabuff.com/assets/skills/naga-siren-mirror-image-5467-b4c7b9ba448cd320a702dc27512f3bbdd5613c943ae322654163f6dca7592819.jpg);
background-repeat: repeat;
}
JavaScript
const PIC_H = 128;
[...document.getElementsByClassName('myDiv')]
.filter(el => el.offsetHeight % PIC_H > 0)
.forEach(el => {
const newSize = el.offsetHeight + PIC_H - (el.offsetHeight % PIC_H);
el.style.height = `${newSize}px`;
});