# How transform a square image into a triangle (by scaling the height with a factor linearly decreasing from left to right)?

Suppose I have a square image in GIMP. I want the height to be scaled non-uniformly in a specific way. The left-most column of pixels should not be affected at all. The right-most column of pixels should be compressed into a single pixel (by taking the average colour). From left to right, the columns of pixels should be scaled down increasingly (i.e. scaled into shorter and shorter columns). The final result should be a triangle with the upper-left corner, the lower-left corner, and the lower-right corner of the canvas as its corners.

In other words: scale the height of the image with a factor 1.0 on the left, a factor roughly 0.001 on the right, and a linearly decreasing factor from left to right.

This formula gives the idea (except it's zero on the right): `scaleFactor = (imageWidth - x)/imageWidth` where `x = 0` on the left of the canvas and `x = imageWidth` on the right.

Of all the tools/filters I've tried, the "perspective" tool came closest to what I want. I can use it to make a square into a triangle, but it compresses one half of the image and blows up the other half.

Thanks.