There are many factors that go into optimizing images.
You can use the default NextJS `import Image from "next/image"`.
When the application is built, it will optimize the image immediately.
If you use external images, you must add a whitelist in next.config.js.