-distort SRT

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
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

-distort SRT

Post by GreenKoopa »

I'm not getting what I expect for case "c". This case should be "ScaleX,ScaleY Angle", but looks like "X,Y Angle". Would someone please run and confirm?

http://www.imagemagick.org/script/comma ... hp#distort

convert -size 80x80 xc:red -virtual-pixel black -distort SRT "5" a.png
convert -size 80x80 xc:red -virtual-pixel black -distort SRT "0.5 5" b.png
convert -size 80x80 xc:red -virtual-pixel black -distort SRT "1,0.5 5" c.png
convert -size 80x80 xc:red -virtual-pixel black -distort SRT "0,0 1 5" d.png
convert -size 80x80 xc:red -virtual-pixel black -distort SRT "0,0 1,0.5 5" e.png

convert a.png b.png c.png d.png e.png -bordercolor none -border 10x10 +append abcde.png
Image

EDIT: Simplified test and added image.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -distort SRT

Post by anthony »

It is X,Y Angle!
See IM Examples, SRT distort...
http://www.imagemagick.org/Usage/distorts/#srt

Basically when 3 values are provided it assumes you have given it the center coordinates (control point) for the rotation, not separate X,Y scaling factors.

However you can simply substitute '%[fx:w/2],%[fx:h/2]' for those values (center point of image - may be a floating point number!), to make it a 5 value SRT distortion. That is...
-distort SRT '%[fx:w/2],%[fx:h/2] 1,0.5 5'

Remember coordinate values are in Image Coordinates. meaning that the top left edge is 0,0 but the center of the top left pixels is 0.5,0.5 If you want to rotate around a actual pixel, then the coordinate will be X+0.5,Y+0.5 See
Image Coordinates vs Pixel Coordinates
http://www.imagemagick.org/Usage/distor ... oordinates
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: -distort SRT

Post by GreenKoopa »

Should I contact someone (who and how) about this documentation error?

http://www.imagemagick.org/script/comma ... hp#distort
is in conflict with
http://www.imagemagick.org/Usage/distor ... oordinates

-----

Using -set option:distort:scale, can separate x & y scaling factors be specified?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -distort SRT

Post by anthony »

Hmmm it seems that the offical documentation has it wrong. I will fix that.

The documentation is correct in the source and on IM Examples, just wrong on the command line options site. -- Fixed give it s few hours for various web caches to update.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply