try removing the curly braces in your lambda statement:
Task<int> task1 = new Task<int>(()=> CountPixels(croppedBitmap, Color.FromArgb(255, 255, 255, 255)); );
There are different kinds of lamdas, for example this is an expression lambda (according to msdn):
(x, y) => x == y
It returns the result of the expression.
And this is the statement lambda:
(x, y) => { return x == y; }
So, when you use curly braces you are creating a statement lambda and there is no implicit returning, you have to explicitly use the return
to return a value.