STR without -distort

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

Re: STR without -distort

Post by fmw42 »

rborn wrote:hi
I am trying to make a STR (Scale Translate Rotate) but without the -distort option, as many hosted servers have older versions of IM.
i managed to make it with a code like this

Code: Select all

convert -size 600x480 xc:black  -draw "translate 219,324 rotate 21  image over -330,-264 660,528   'e.jpg' "  nat.png
but the quality is awful



e.jpg looks just fine, but the result, nat.png is very pixelated

can you help me with another way of doing this?

thank you
You could insert your e.jpg image into a larger background image such that the center of the new image contained the e.jpg at the offset coordinates you want. Then use -rotate (about the new center which is now at your offset coordinates), Then use -trim to remove the background.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: STR without -distort

Post by anthony »

Have you tried the individual components of the distortion?

The edges are pixelated. but I think this may be a limitation of the draw. Also I am not certain if draws read in scaling is a 'sample' type scale or a proper resize with a proper resize filter.

Generating a distortion basied on specific scale, Rotate and translate parameters is actually not easy which was one reason the SRT distrtion was added. Internally in draw, and distort the various actions would be combined into a affine matrix.

You can find out more about this in... http://www.imagemagick.org/Usage/distort/affine/

Also included are reference to some utilities for generating the affine matrix (either for -draw or -transform) from separate S,R,T components
http://www.imagemagick.org/Usage/distor ... ne_scripts

These scripts were the prototype for the eventual addion of the -distort SRT method.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply