(none) imager-devel
/ help / lists / applications / search /
 

Using other applications affine transformation matrixes with Imager

From: Bernhard Wei▀huhn (
19175@xyz.molar.is)
Date: Sat 07 Nov 2009 - 19:03:46 GMT

  • Next message: Tony Cook: "Re: Using other applications affine transformation matrixes with Imager"

    Hi,

    being seriously impressed with the performance of Imager, I want to
    convert an application from using Imagemagick's affine transform
    functions to Imagers own matrix_transform().
    Unfortunately, their behaviour is quite different.

    ImageMagick (and Cairo too btw.) use six-coefficient matrices like to:

    [ sx, rx,
       ry, sy,
       tx, ty ]

    ... which i naively converted to Imagers nine coefficient matrix like
    this:

    [ sx, rx, tx,
       ry, sy, ty,
       0, 0, 1 ]

    Unfortunately, it's not that easy. By trial and error I ended up with
    some modifications (1/sx etc), which give better results for easy
    cases, but fail as soon as negative parameters or more complex
    combinations are involved. I suspect a relatively easy mathematical
    transformation of the paramters, but I can't figure it out by myself.

    Can somebody point me in the right direction?

    ImageMagick's matrix transformations are explained in detail here: http://www.imagemagick.org/Usage/distorts/affine/

    Btw: I was supprised to see Cairo working with imagemagicks matrices
    out of the box, but I'd like to avoid my current hack moving image
    data back and forth between Imager and Cairo ImageSurfaces, and would
    rather use Imagers builtin matrix_transform, since it not only seems
    faster, but also prettier.

    Any help greatly appreciated,
       bkw



  •