Skip to content

Instantly share code, notes, and snippets.

View ShantanuJoshi's full-sized avatar

Shantanu Joshi ShantanuJoshi

View GitHub Profile
@ShantanuJoshi
ShantanuJoshi / Dockerfile
Created January 22, 2021 21:04
React App Dockerfile
FROM node:14.2.0-alpine3.10
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
COPY package.json ./
RUN yarn install --production --silent
#run this in any directory with the max width parameter add -v for verbose
#image will be scalled in proportion to confine within the max width parameter
#this allows you to get images that are within a box dimension for online publishing (i.e. 400x400) without distorting the image
#get Pillow (fork of PIL) from pip before running --> pip install Pillow
#regarding timing: 42 seconds for 4938 so max 15 minutes for 100,000 images
import os
@ShantanuJoshi
ShantanuJoshi / compressMe.py
Last active April 29, 2022 18:15
Python Image Compress
#run this in any directory add -v for verbose
#get Pillow (fork of PIL) from pip before running --> pip install Pillow
import os
import sys
from PIL import Image
def compressMe(file, verbose=False):
filepath = os.path.join(os.getcwd(), file)
oldsize = os.stat(filepath).st_size