def pixel_to_terrain_height(pixel):
    """
    Convert a RGBA pixel to a terrain height.

    The R channel composes the lower 8 bits, the G channel composes the upper 8 bits.
    """
    return pixel[0] & 0xff |( (pixel[1] & 0xff) << 8)