How To Resize an Image Correctly in JavaScriptby@trekhleb
3,125 reads
3,125 reads

How To Resize an Image Correctly in JavaScript

by Oleksii Trekhleb20mMay 2nd, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

The Seam Carving algorithm is to find the seam (continuous sequence of pixels) with the lowest contribution to the image content and then carve (remove) it. This process repeats over and over again until we get the required image width or height. To make the seam search faster the dynamic programming approach might be applied (we'll be using TypeScript for it) The algorithm is not a silver bullet, and it may fail to resize images where most of the pixels are edges (look important to the algorithm)

Companies Mentioned

Mention Thumbnail
Mention Thumbnail

Coins Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - How To Resize an Image Correctly in JavaScript
Oleksii Trekhleb HackerNoon profile picture
Oleksii Trekhleb

Oleksii Trekhleb

@trekhleb

Software Engineer @ UBER. Author of the 100k ⭐️ javascript-algorithms repository on GitHub.

About @trekhleb
LEARN MORE ABOUT @TREKHLEB'S
EXPERTISE AND PLACE ON THE INTERNET.

Share Your Thoughts

About Author

Oleksii Trekhleb HackerNoon profile picture
Oleksii Trekhleb@trekhleb
Software Engineer @ UBER. Author of the 100k ⭐️ javascript-algorithms repository on GitHub.

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
L O A D I N G
. . . comments & more!