anowell

anowell / content_aware_resize / 0.1.0

README.md

Overview

Content aware image resizing, liquid image resizing, retargeting, or seam carving, refers to a image resizing technique where one can insert or remove seams, or paths of least importance, in order to shrink or grow the image.

Here you can see a photo that was originally 700px wide, and we removed 100px of width.

Usage

These parameters are required:

- source: The data URI of the source image to upscale (stick to PNGs for now)

- dest: The data URI where the resized image will be saved

- relative: The relative dimensions to resize the photo by specified as an array of [delta_x, delta_y]. For example, [-50, 0] would remove 50px from the width, but leave the height the same. (Currently this doesn't work for increasing size, but it should eventually.)

Credits

This algorithm is primarily a wrapper around this project of the same name by Martin Hafskjold Thoresen. Be sure to check out his excellent blog post explaining how it works.