Page 1 of 1

Content-aware scaling (or other recommendations)

Posted: 2010-07-30T04:38:46-07:00
by unsorted
I'm looking to build a web application that allows users to morph a car's shape. A simple implementation would be to stretch the car lengthwise or heightwise, but without making the car seem like a cheap stretched image. So ideally I'd like to do some sort of content-aware stretching. I couldn't find any information on whether this functionality exists in ImageMagick; my guess is no, and that's okay--I'm also just generally looking for tips on types of transformations I could use to make varying car shapes.

For instance, I was thinking about some sort of pixel mapping algorithm, where one starts with a car and a skeleton, and then dragging the skeleton results in the car morphing. Would this be hard to do?

By the way, these are probably 2D pictures of cars (to keep things simple) and they have no background (so let's say they're vector art-type graphics).

Thanks in advance for any suggestions you may have!

Re: Content-aware scaling (or other recommendations)

Posted: 2010-07-30T09:29:53-07:00
by fmw42
I don't know if this is relevant, but you might want to look at my shapemorph script at the link below. It is a one point (actually five including the corners) morph.

As for your question about content-aware stretching, IM does not have anything like that to my knowledge and I am not really sure I understand what you really want. Perhaps some manually made examples might help us understand so we can perhaps offer some suggestions.

Re: Content-aware scaling (or other recommendations)

Posted: 2010-08-01T20:56:14-07:00
by anthony
The only content aware reszing is Liquid Rescale
http://www.imagemagick.org/Usage/resize/#liquid-rescale

However while IM has implemented basic featurs, other features of the LQR library are not available (yet). Specifically energy masking to either protect or not protect parts of the image from rescaling effects.

Re: Content-aware scaling (or other recommendations)

Posted: 2010-08-01T22:15:11-07:00
by fmw42
Yes, but he wants to stretch and liquid-resize only shrinks (to my knowledge). But I have not tried to use it to stretch.

Re: Content-aware scaling (or other recommendations)

Posted: 2010-08-02T23:28:37-07:00
by anthony
It can stretch in the same way it shrinks. Basically it will double a line of pixels that has the least energy function.

Re: Content-aware scaling (or other recommendations)

Posted: 2010-08-02T23:36:43-07:00
by fmw42
thanks, I had not remembered.

I did some tests a long time ago, which can be seen at http://www.fmwconcepts.com/misc_tests/l ... index.html

and you are right, I tested both shrinking and enlarging.