Skip to content
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

Shrink images to the size they are actually used #152

Merged
merged 1 commit into from
Nov 2, 2016
Merged

Conversation

Cantido
Copy link
Contributor

@Cantido Cantido commented Nov 2, 2016

Also adjust pixel dimensions very slightly so that all images are the exact same dimensions. We're talkin' one- or two-pixel changes, but the misalignment is noticeable if you look closely. All of the content-type images were resized to 600x400, and the DPI for some images was reduced to 72 pixels/inch (they were sometimes as high as 150 px/inch). For digital-notebook.jpg, I cropped out the part that wasn't being displayed. Its position is shifted slightly due to that change, but it's still centered and everything.

These changes result in a visual improvement. Not only does it fix the aforementioned aspect ratio mismatches, it improves the quality of the scaled-down images. I guess the browser did a poor job scaling the images down, because more detail is visible in the scaled-down versions.

Fixes #150.

Size changes

image old size new size
characters.jpg 4.71 MB 23.8 kB
creatures.jpg 1.11 MB 28.6 kB
groups.jpg 4.49 MB 12.9 kB
items.jpg 2.22 MB 33.4 kB
languages.jpg 4.57 MB 51.5 kB
locations.jpg 2.88 MB 59.9 kB
magics.jpg 6.29 MB 13.1 kB
races.jpg 2.13 MB 34.5 kB
religions.jpg 12 MB 58.1 kB
scenes.jpg 4.72 MB 45.6 kB
universes.jpg 4.44 MB 51.2 kB
digitial-notebook.jpg 963 kB 111.0 kB
TOTAL 50.52 MB 523.6 kB

This means these images are ninety-nine percent smaller with no noticeable degradation in quality. 😸

Also adjust pixel dimensions very slightly so that all
images are the exact same dimensions. We're talkin'
one- or two-pixel changes, but the misalignment is
noticeable if you look closely.

Finally, the pixel density of the images are adjusted
as well. The change is not noticeable, but results in
much smaller file sizes.

These changes result in a visual improvement. Not only
does it fix the aforementioned aspect ratio mismatches,
it improves the quality of the scaled-down images.
I guess the browser did a poor job scaling the images
down, because more detail is visible in the scaled-down
versions.
@drusepth
Copy link
Member

drusepth commented Nov 2, 2016

Wow, very awesome. Great work -- shipping!

@drusepth drusepth merged commit 3005eb4 into master Nov 2, 2016
@drusepth drusepth deleted the optimize-images branch November 2, 2016 13:56
Cantido added a commit that referenced this pull request Nov 3, 2016
Our application JS is bloated with minified libraries, while our actual
application Javascript barely amounts to more than two hundred lines.
I propose removing these libraries from our sass file, and instead
load them as separate resources in `<link>` and `<script>` tags.

This has several advantages:

 - By using common CDNs, users are likely to have many of these libraries
   cached already.
 - Even if the files aren't cached, the CDN is likely to deliver them
   faster.
 - We can use the HTML5 'async' attribute to load these libraries
   asynchronously, so users aren't held up while they download.
 - Our fully compiled application JS is much, much smaller, which
   reduces the load on our host.

Also, on the topic of load times, I realized that in #152 that one of the
images was a PNG, not a JPG. I had tried optimizing the image, but I didn't
realize that it wasn't a JPG like the others. Here, I converted it to a JPG,
and it is significantly smaller, and it is visually unchanged.

I'm having some difficulty testing on my local machine, so I would appreciate
some additional manual testing before merging this.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Content header images need optimized
2 participants