The name of a file in the raster graphics format of your choice. The chosen format must support at least 8 bits per channel and 3 channels.
A file in the same format, with the same dimensions and pixels as the first, but whose pixels are grouped in descending order of the number of times they occur, sorted from left-to-right, top-to-bottom.
- If certain colours of pixels appear the same number of times, their order is unspecified.
- You must not overwrite the input file (use a different file name for the output).
- Any and all third-party image processing libraries are permitted.
Will give output similar to:
Especially in the lower parts of the image some variation may occur, due to different tie breaking between colours of equal frequency.
File-type object...? That would make a large difference in some languages. \$\endgroup\$