Resizing Image for Frontend with Python
- By : Mydatahack
- Category : Front-End, Web Technologies
- Tags: Front End, Image, Python, Resize
We can optimise the load time by using different image sizes for different screen widths. There is no point in loading a huge image for a mobile when the width is only for 200px. Here is the quick Python script to resize images. By changing the array, you can output as many dimensions as you want.
It will work for both square and rectangle images. For rectangle images, it will keep the width: height ratio. We can pass multiple image files with multiple target widths.
That’s it. Pretty cool!