Content-aware scaling (or other recommendations)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
unsorted

Content-aware scaling (or other recommendations)

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Content-aware scaling (or other recommendations)

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Content-aware scaling (or other recommendations)

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Content-aware scaling (or other recommendations)

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Content-aware scaling (or other recommendations)

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Content-aware scaling (or other recommendations)

Post 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.
Post Reply