Image and histogram generation separation

Generation of histograms is very memory hungry so relatively few concurrent histograms should be created at a time. Image generation requires less memory and thus works fine with more threads. This branch introduces different max threads for the two processes.