I used a perspective transformation on an image in GIMP, but not before I forgot to record the transformation matrix it used. (I need to apply the same transformation to a bunch of other images.)

I haven't even saved the image yet; the perspective transformation is still in my undo history. How can I find that matrix?


1 Answer 1


Most of the actions with tools in GIMP can be undone with CTRL+Z and all the settings will be set to the values just before applying them or you can view/reapply the last action with the options from the Filters menu. Unfortunately both are not implemented for the Perspective transform tool (or any of the transform tools IIRC).

Your best option is to copy the transformed image (to the clipboard), undo the transformation, paste as a new layer (from the clipboard) and try to achieve the same perspective correction while comparing with the transformed layer. Before hitting apply and do what you want with your transformation matrix.

Alternatively, get the x and y coordinates of the four corners of the transformation mesh and open Filters > Script-Fu > Console and write down for every image:

(gimp-drawable-transform-perspective (car (gimp-image-get-active-drawable (aref (cadr (gimp-image-list)) 0))) tl_X tl_Y tr_X tr_Y bl_X bl_Y br_X br_Y 0 2 FALSE 3 0)

Replace tl_X to br_Y with their respective coordinates.

tl = top-left
tr = top-right
bl = bottom-left
br = bottom-right

This modifies the last opened image.

  • \$\begingroup\$ Why is the matrix 2x2x2 and not 2x2 for linear transform or 3x3 for affine transform? \$\endgroup\$ Jun 8, 2015 at 18:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.