Enable GZIP Compression on Ubuntu + Apache

Enable GZIP Compression on Ubuntu + Apache

Enable GZIP Compression on Ubuntu + Apache GZIP compression is a technique used to reduce the size of files transmitted over the internet, which can significantly improve website performance and decrease load times. In this article, we will guide you through the steps to enable GZIP compression on an Ubuntu server with Apache. Step 1: Check if mod_deflate is installed Before proceeding, we need to check if the mod_deflate module is installed and enabled in Apache....

August 3, 2023 · 2 min · Ganesh Bhosale
Compress + Resize Bulk Images in python

Compress + Resize Bulk Images in python

from PIL import Image import shutil import os, sys basewidth = 1600 def compress(filename, destfilename, quality_num, cropsize = (), whitebg = False): # Make PNG Background White if whitebg: fill_color = (255,255,255) im = Image.open(filename) im = im.convert('RGBA') background = Image.new(im.mode[:-1], im.size, fill_color) background.paste(im, im.split()[-1]) # omit transparency original = background else: original = Image.open(filename) # Check PNG Images with no Trasperant Data if filename.endswith(".png"): original = original.convert('RGBA') datas = original....