Great question — answering as the UphillTech team:
There’s a discussion and related example over at the Next.js GitHub project. It sounds like that example achieves what you want to do. tl;dr: <div className="h-64 w-96 relative"> // "relative" is required; adjust sizes to your liking <Image src={img.img} alt="Picture of the author" layout="fill" // required objectFit="cover" // change to suit your needs className="rounded-full" // just an example /> </div> The image will preserve its original aspect ratio and fill / cover (or whatever object-fit you chose) the size of the outer div , which you can set using Tailwind classes. Other styles, like rounded corner, can be applied to the Image .
Full answer by tjanson: https://stackoverflow.stackexchange.com/a/65134645 (CC BY-SA 4.0).
Need it done for your business? UphillTech.