How can I resize a rendered ray traced image? Say I have rendered an HDR ray traced image with dimensions 1920x1080 (width x height) pixels and I want to instead represent it with dimensions 960x540. Assume as well that the image has not yet been gamma corrected (i.e. it is still in linear space). How should I go about downsampling the image such that I don't need to re-render the image in the new dimensions?
Since you want to downsample the image by a factor of 2 along each axis, a simple and easy thing to do is just average a 2&times;2 box of source pixels to generate each destination pixel. In pseudocode this would look like:

for dest_y = 0 to 540
    src_y = dest_y*2
    for dest_x = 0 to 960
        src_x = dest_x*2
        average = 0.25 * (src[src_y][src_x] + src[src_y][src_x+1] +
                          src[src_y+1][src_x] + src[src_y+1][src_x+1])
        dest[dest_y][dest_x] = average


This will do an okay job, but for higher-quality downsampling or resizing images to any size (not just neat integer factors), I suggest looking at the stb_image_resize library. It's quite easy to use, supports either 8-bit or floating-point images with any number of channels, and gives good results.