Skip to content

Squash images #201

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified assets/adb_enhanced.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/angr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/astropy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/axelrod.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/biobuilds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/biopython.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/bokeh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/ccxt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/chaquopy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/cmd2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/dateutil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/fecon235.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/fenics.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/fonttools.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/freud.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/geopy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/ipython.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/jupyter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/kivy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/matplotlib.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/metpy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/mitmproxy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/mne.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/nengo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/nikola.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/openquake.png
Binary file modified assets/osbrain.png
Binary file modified assets/pandas.png
Binary file modified assets/pillow.png
Binary file modified assets/psi4square.png
Binary file modified assets/pylast.png
Binary file modified assets/pymc3.png
Binary file modified assets/pymeasure.png
Binary file modified assets/pyscipopt.png
Binary file modified assets/pystan.png
Binary file modified assets/pytest1.png
Binary file modified assets/pythran.png
Binary file modified assets/rdkit.png
Binary file modified assets/requests.png
Binary file modified assets/rpy2_logo_64x64.png
Binary file modified assets/saltstack.png
Binary file modified assets/scikit-image.png
Binary file modified assets/scikit-learn.png
Binary file modified assets/scipyshiny_small.png
Binary file modified assets/signac.png
Binary file modified assets/skbio.png
Binary file modified assets/spyder.png
Binary file modified assets/sunpy.png
Binary file modified assets/swcarpentry.png
Binary file modified assets/sympy.png
Binary file modified assets/tensorflow.png
Binary file modified assets/tensorpack.png
Binary file modified assets/tornado.png
Binary file modified assets/toyplot-256x256.png
Binary file modified assets/tryton.png
Binary file modified assets/xarray.png
Binary file modified assets/xonsh.png
Binary file modified assets/yt.png
Binary file modified assets/zulip.png
Binary file modified img/bgnoise.png
15 changes: 15 additions & 0 deletions scripts/squash-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# pip install pillow
python3 scripts/thumbnail-images.py

# https://pngquant.org/
# On Mac: brew install pngquant

# Options:
# --ext .png Output to same filename, don't append anything else
# --force Overwrite existing output files
# --speed 1 Slow speed, best quality
# --strip Remove optional metadata

pngquant --ext .png --force --speed 1 --strip assets/*.png img/*.png
22 changes: 22 additions & 0 deletions scripts/thumbnail-images.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
# encoding: utf-8
"""
Thumbnail images to a maximum of 320px wide and 160px high
"""
import glob

from PIL import Image # pip install pillow

max_size = 320, 160

# Exclude these images from thumbnailing
excludes = ["assets/signac.png"]

for infile in glob.glob("assets/*.png"):
if infile in excludes:
continue
im = Image.open(infile)
if im.width <= max_size[0] and im.height <= max_size[1]:
continue
im.thumbnail(max_size)
im.save(infile)