Image resizing library "Caire" which can finish to an image without discomfort even if you resize ignoring the aspect ratio



Of image fileresizeAllpixelIt stretches and shrinks evenly. For this reason, when resizing ignoring the aspect ratio of images containing people or buildings, the balance of the subjects will collapse, resulting in an unnatural image. Image resizing library "Caire"Can be resized while maintaining the ratio of people and buildings in the image and create images that do not feel strange.

GitHub - esimov / caire: Content aware image resize library
https://github.com/esimov/caire

"Caire"Seam carvingalgorithmIt is a library for image resizing using. The Seam carving algorithmResponsive web designIt is aimed at making images that do not feel strange even if resizing ignoring the aspect ratio is done on contents that resize images according to the screen size like a web page adopting.

For example, when reading the following image and shrinking the width by the Seam carving algorithm ......


We create an energy map and find out the part without features in the image, so-called ignore it.


The part which was judged as no problem ignoring in the following image is the part of the red line.


If you delete the red line part, resizing is completed. With the size of the building and the person being maintained, it is finished to an image which does not feel uncomfortable.


In addition, when widening the width, if you duplicate parts that do not feature more and more, you can also expand the width without discomfort.


"Caire" is a program language developed by Google "Go"In order to use it, it is necessary to install Go in advance.Caire's documentationThe installation method of Linux installation is introduced above.

CaireCommand lineIt is supposed to be used in the following options are available.


For example, by inputting the following command, it is possible to reduce the aspect ratio of source.jpg by 20% and save it as out.jpg file name.

$ caire -in input / source.jpg-out. / out.jpg -perc = 1 -width 20 -height 20 -debug = false

in Review,   Software,   Design, Posted by darkhorse_log