\begin{equation*}
\begin{pmatrix}
x' \\
y' \\
1
\end{pmatrix}
=
\begin{pmatrix}
a \amp b \amp c \\
d \amp e \amp f \\
0 \amp 0 \amp 1
\end{pmatrix}
\begin{pmatrix}
x \\
y \\
1
\end{pmatrix}
\end{equation*}
Hence we get
\begin{equation*}
x' = a \cdot x + b \cdot y + c, \quad y' = d \cdot x + e \cdot y + f.
\end{equation*}
For a shear in the \(x\)-direction, we wish to shift \(x\) proportionally to \(y\) while leaving \(y\) unchanged. This corresponds to:
\begin{equation*}
a = 1, \quad b = k, \quad c = 0,
\quad d = 0, \quad e = 1, \quad f = 0
\end{equation*}
where \(k\) is the shear factor. Thus, the shear matrix becomes:
\begin{equation*}
\begin{bmatrix}
1 \amp k \amp 0 \\
0 \amp 1 \amp 0 \\
0 \amp 0 \amp 1
\end{bmatrix}.
\end{equation*}
In Pythonβs Pillow library, the transform method uses parameters \((a, b, c, d, e, f)\) corresponding to the first two rows of the above matrix, that is,
\begin{equation*}
(a, b, c, d, e, f) =
(1, k, 0, 0, 1, 0).
\end{equation*}