The six lines in the .tfw file describe:
- pixel size in the x-direction in map units/pixel
- rotation about y-axis
- rotation about x-axis
- pixel size in the y-direction in map units, almost always negative
- x-coordinate of the center of the upper left pixel
- y-coordinate of the center of the upper left pixel
If you are just downsampling the image, you aren't changing the rotation (2 & 3).
You are changing the pixel size (1 & 4), so you'll need to manipulate these values. If you downsample the image to half of its original size, each pixel will cover twice the area so you'll have to double this value.
Since the pixel size has changed, the center of the top-left pixel is also going to move, so you'll need to modify 5 & 6 by the appropriate amount. If you downsample by a factor of X
in the direction of pixel size P
(lines 1 & 4), you'll need to increase/decrease those values by (X-1)/2 * P
.
So for example, you have the following world file and you downsample the image by 2:
10
0
0
-10
10000
20000
The new world file should be:
20
0
0
-20
10005
19995