0

I am working on a Front end feature that requires to resize an image uploaded by users (with various dimensions) to a new resized image with a fixed height of 200px. The width will change based on the given height in order to keep the aspect ratio.

I have tried to search for several solutions by using canvas, but unfortunately there are no answers that can precisely solve my problem.

I know resizing images have been a challenge for years, and i am really looking forward to your helps

  • Please post the code that you tried, even if not working. Does this help? [ReactJS: Resize image before upload](https://stackoverflow.com/questions/61740953/reactjs-resize-image-before-upload) – Yogi Dec 11 '22 at 12:43
  • I tried that library, and I have no idea why the image quality decreases tremendously after resizing. – Huynh Minh Dec 11 '22 at 14:20
  • Reducing large images to 200px may require antialiasing to prevent distortions. If you want to know the math behind it search for "Nyquist–Shannon sampling theorem". This [previous question](https://stackoverflow.com/a/17862644/943435) provides some practical ways to improve the image quality. – Yogi Dec 11 '22 at 19:20
  • Please provide enough code so others can better understand or reproduce the problem. – Community Dec 11 '22 at 22:57

0 Answers0