@@ -103,10 +103,10 @@ const transformationMatrix = [
103103 [0 , 2 , 0 ], // d=0, e=2 (vertical scale), f=0
104104];
105105
106- const scaledImage = image .transform (transformationMatrix );
106+ const scaledImage = image .transform (transformationMatrix , { fullImage: true } );
107107```
108108
109- ![ Scaled image] ( ./images/transformations/lennaScaled .png )
109+ ![ Scaled image] ( ./images/transformations/barbaraScaleDemo .png )
110110
111111### Non-uniform Scaling
112112
@@ -116,11 +116,11 @@ const transformationMatrix = [
116116 [3 , 0 , 0 ], // Horizontal stretch
117117 [0 , 0.5 , 0 ], // Vertical compression
118118];
119-
120- const stretchedImage = image .transform (transformationMatrix );
119+ // Added trueImage to include all pixels into a destination image
120+ const stretchedImage = image .transform (transformationMatrix ,, { fullImage: true } );
121121```
122122
123- ![ Stretched image] ( ./images/transformations/lennaStretched .png )
123+ ![ Stretched image] ( ./images/transformations/barbaraStretchDemo .png )
124124
125125::: note
126126ImageJS also has [ ` resize ` ] ( ../features/geometry/resize.mdx ) function that allows to scale an image.
@@ -135,32 +135,32 @@ const shrinkMatrix = [
135135 [0.5 , 0 , 0 ],
136136 [0 , 0.5 , 0 ],
137137];
138- const shrunkImage = image .transform (shrinkMatrix );
138+ const shrunkImage = image .transform (shrinkMatrix , { fullImage: true } );
139139```
140140
141- ![ Shrunk image] ( ./images/transformations/lennaShrunk .png )
141+ ![ Shrunk image] ( ./images/transformations/barbaraShrinkDemo .png )
142142
143143``` ts
144144// Mirror horizontally (flip left-right)
145145const mirrorMatrix = [
146146 [- 1 , 0 , 0 ],
147147 [0 , 1 , 0 ],
148148];
149- const mirroredImage = image .transform (mirrorMatrix );
149+ const mirroredImage = image .transform (mirrorMatrix , { fullImage: true } );
150150```
151151
152- ![ Mirrored image] ( ./images/transformations/lennaMirrorred .png )
152+ ![ Mirrored image] ( ./images/transformations/barbaraMirrorDemo .png )
153153
154154``` ts
155155// Mirror vertically (flip up-down)
156156const flipMatrix = [
157157 [1 , 0 , 0 ],
158158 [0 , - 1 , 0 ],
159159];
160- const flippedImage = image .transform (flipMatrix );
160+ const flippedImage = image .transform (flipMatrix , { fullImage: true } );
161161```
162162
163- ![ Flipped image] ( ./images/transformations/lennaFlipped .png )
163+ ![ Flipped image] ( ./images/transformations/barbaraFlipDemo .png )
164164::: note
165165ImageJS also has [ ` flip ` ] ( ../features/geometry/flip.mdx ) function that allows to flip an image.
166166Current tutorial just demonstrates the basic principle behind transformation of such kind.
@@ -180,7 +180,7 @@ const translationMatrix = [
180180const translatedImage = image .transform (translationMatrix );
181181```
182182
183- ![ Translated image] ( ./images/transformations/lennaTranslated .png )
183+ ![ Translated image] ( ./images/transformations/barbaraTranslateDemo .png )
184184
185185### Rotation
186186
@@ -204,7 +204,7 @@ const rotationMatrix = [
204204const rotatedImage = image .transform (rotationMatrix );
205205```
206206
207- ![ Rotated image] ( ./images/transformations/lennaRotated .png )
207+ ![ Rotated image] ( ./images/transformations/barbaraRotateBy45Demo .png )
208208
209209### Shearing
210210
@@ -222,7 +222,7 @@ const horizontalShearMatrix = [
222222const horizontalShearImage = image .transform (horizontalShearMatrix );
223223```
224224
225- ![ Horizontally sheared image] ( ./images/transformations/lennaHorizontalShear .png )
225+ ![ Horizontally sheared image] ( ./images/transformations/barbaraHorizontalShearDemo .png )
226226
227227#### Vertical shearing
228228
@@ -236,7 +236,7 @@ const verticalShearMatrix = [
236236const verticalShearImage = image .transform (verticalShearMatrix );
237237```
238238
239- ![ Vertically sheared image] ( ./images/transformations/lennaVerticalShear .png )
239+ ![ Vertically sheared image] ( ./images/transformations/barbaraVerticalShearDemo .png )
240240
241241#### Combined shearing
242242
@@ -250,7 +250,7 @@ const combinedShearMatrix = [
250250const combinedShearImage = image .transform (combinedShearMatrix );
251251```
252252
253- ![ Combined shearing] ( ./images/transformations/lennaCombinedShear .png )
253+ ![ Combined shearing] ( ./images/transformations/barbaraCombinedShearDemo .png )
254254
255255### Complex Affine Transformations
256256
@@ -299,7 +299,7 @@ const rotateAroundCenterImage = image.transform(
299299);
300300```
301301
302- ![ Rotated by center image] ( ./images/transformations/lennaRotatedCenter .png )
302+ ![ Rotated by center image] ( ./images/transformations/barbaraRotateAroundCenterDemo .png )
303303
304304::: note
305305Image-js also has [ ` rotate() ` ] ( ../features/geometry/rotate.mdx ) and [ ` transformRotate() ` ] ( ../features/geometry/transform-and-rotate.mdx ) functions. ` rotate() ` function allows rotating an image by multiple of 90 degrees.
0 commit comments