esimov / caire
- среда, 31 января 2018 г. в 03:14:31
Content aware image resize library
Caire is a content aware image resize library based on Seam Carving for Content-Aware Image Resizing paper.
Original image | Energy map | Seams applied |
---|---|---|
![]() |
![]() |
![]() |
Key features which differentiates from the other existing open source solutions:
$ go get github.com/esimov/caire/cmd/caire
$ go install
$ caire -in input.jpg -out output.jpg
$ caire --help
The following flags are supported:
Flag | Default | Description |
---|---|---|
in |
n/a | Input file |
out |
n/a | Output file |
width |
n/a | New width |
height |
n/a | New height |
perc |
false | Reduce image by percentage |
blur |
1 | Blur radius |
sobel |
10 | Sobel filter threshold |
debug |
false | Use debugger |
In case you wish to reduce the image size by a specific percentage, it can be used the -perc
boolean flag, which means you need only to specify that you want to deal with percentages instead of concrete values. In this case the values provided for width and height will be expressed as percentage. Here is a sample command using -perc
:
caire -in input/source.jpg -out ./out.jpg -perc=1 -width 20 -height 20 -debug false
which reduces the image width & height by 20%.
The CLI command can process all the images from a specific directory too.
$ caire -in ./input-directory -out ./output-directory
Original | Shrinked |
---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Original | Extended |
---|---|
![]() |
![]() |
![]() |
![]() |
This project is under the MIT License. See the LICENSE file for the full license text.