By Hannes Marais and Tom Rodeheffer
Dr. Dobb's Journal January 1999
Initialize the differential to the_number_of_original_pixels; Initialize the accumulated_differential to 0; Get the first original pixel; Do Copy original_pixel to next_resized_pixel; accumulated_differential += differential; if all pixels are processed exit; while accumulated_differential >= the_number_of_output_pixels do accumulated_differential -= the_number_of_output_pixels; Get next original pixel; done done
Example 2: Revised algorithm.
Copyright © 1999, Dr. Dobb's Journal