'-liquid-rescale in GraphicsMagick or other SeamCarving command-line tools

I'm using GraphicsMagic (and have several bindings that require GM). Now I have to rescale images by Seam Carving algorithm that is available in ImageMagic via -liquid-rescale option but is missing in GM (isn't it?). Is there any options to install both GM and IM without conflicts (on Ubuntu 12.04) or is there any other command-line tools that can perform SeamCarving/LiquidRescale?



Solution 1:[1]

You can build a very simple script with python and scikit implementation. Additionally, many tools like this are available on github. Just as an example:

from skimage import data, draw
from skimage import transform, util
import numpy as np
from skimage import filters, color
from matplotlib import pyplot as plt

img = data.rocket()
img = util.img_as_float(img)

eimg = filters.sobel(color.rgb2gray(img))
out = transform.seam_carve(img, eimg, 'vertical', 200)
plt.title('Resized using Seam Carving')
plt.imshow(out)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1