Blurry output often comes from enlarging a small source or repeatedly saving a lossy file. Begin with the highest-quality original, choose the final aspect ratio, and calculate pixel dimensions from the actual display size. A 400 CSS-pixel slot can need roughly 800 source pixels on a 2× display.
Downscale once with a good resampler, inspect fine text and edges at the intended viewing size, and export a suitable format. Photographs often work well as JPEG, WebP, or AVIF; sharp diagrams may need PNG or lossless WebP. Keep an untouched master and generate separate derivatives for different layouts. Do not expect an upscaler to restore detail that the original never captured.