Pixel sorting in C | Sololearn: Learn to code for FREE!


Pixel sorting in C

How can I sort pixels of a BMP image based on average value of R+G+B (or any other sorting criteria) by rows? Examples would be helpful

4/19/2022 1:19:49 PM


3 Answers

New Answer


But I am not allowed to use library functions, I need to write an algorithm and then optimise it


https://stackoverflow.com/questions/1787996/c-library-function-to-perform-sort With a barebones sorting function and your custom predicate fn that gives the avg.


If you're not allowed to use premade functions I assume you first have to manually build a BMP file parser and then place all pixels in a buffer and manually iterate, qsort is obsolete.