Image Resizing and Compression
The size of the image will affect the speed of the website. Imagine looking at a picture that's 10 MB in size. If there are 10 pictures on one page, this website will be 100 MB in size, and so it will take a lot of time to get a page. Due to this, a good practice to reduce the size of the image and compress it so that it's around 500 KB in size instead.
In addition, we will also convert the image into JPEG (it has the .JPG
file extension). JPEG is an image compression technology that can remove unnoticeable, insignificant details in an image, thus achieving a smaller file size. Besides, it is often regarded as acceptable to have a lower image quality for web use.
In our Smilecook application, we will convert all our uploaded images into JPG format and compress them. We will do this through the Pillow package.
Note
We cannot have a transparent image in JPEG format. If we save an image with the background removed as a JPEG, the background...