Image processing tips

Preview:

Citation preview

IMAGE PROCESSING TIPS

@TH1AGOFM

TWO TIPS.

@TH1AGOFM

TIP #1

@TH1AGOFM

IMAGE PROCESSING IN A NUTSHELL(for 99.9% of web applications)

ResizeCrop

?@TH1AGOFM

RMAGIC GEM

@TH1AGOFM

✓ ruby C bindings for imagemagick

✖ loads up the image in memory (big memory footprint)

✖ can do funky stuff like changing a image pixel by pixel

@TH1AGOFM

MINIMAGICK GEM

✓ uses imagemagick command line tool “mogrify"

✓ keeps only a reference of the image (low memory footprint)

✓ you can resize, crop and even add watermarks

✓ well-maintained (small plug: by me + nice people)

THEN USE MINIMAGICKAND USE LESS MEMORY

@TH1AGOFM

gem install minimagick

TIP #2

@TH1AGOFM

DO YOU DO LOSSLESS IMAGE OPTIMIZATION?

@TH1AGOFM

BEFORE COMPRESSION612KB

AFTER COMPRESSION560KB(-25%)

NO DIFFERENCE IN QUALITY BIG DIFFERENCE IN SIZE

@TH1AGOFM

Images might have headers with your camera/image editor info or be poorly compressed. The image_optim gem removes it.

HOW CAN YOU DO THAT?

@TH1AGOFM

HOW TO?

gem install image_optim_pack

MACbrew install advancecomp gifsicle jhead jpegoptim jpeg optipng pngcrush pngquant

UBUNTUsudo apt-get install -y advancecomp gifsicle jhead jpegoptim libjpeg-progs optipng pngcrush pngquant

THEN RUN: image_optim -r /my/image/directory

(or use inside ruby — read the docs™)

@TH1AGOFM

NOW YOU CAN

USE LESS MEMORY WITH MINIMAGICK

@TH1AGOFM

USE LESS DISK SPACE & BANDWIDTH WITH IMAGE_OPTIM

THANKS(maybe follow me @th1agofm, slides will be there!)

\

Recommended