Posted 5 months ago. Visible to the public. Repeats.

Optimizing images for web

For webpages to load fast it's recommended to optimize images. Ideally an image's file size should be as small as possible while still being of decent quality. This card demonstrates two command line tools for image optimization

Use identify to fetch information about pictures. convert can change size/quality and strip meta information. Both commands are supplied by ImageMagick.

Copy
$ identify in.jpg in.jpg JPEG 294x440 294x440+0+0 8-bit sRGB 92.8KB 0.000u 0:00.000 $ convert in.jpg -resize x220 -strip -quality 85 out.jpg $ identify out.jpg out.jpg JPEG 147x220 147x220+0+0 8-bit sRGB 10.1KB 0.000u 0:00.000

Always check the output for quality and compare to the original.

makandra has been working exclusively with Ruby on Rails since 2007. Our laser focus on a single technology has made us a leader in this space.

Owner of this card:

Avatar
Daniel Straßner
Last edit:
4 months ago
by Arne Hartherz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Daniel Straßner to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more