// Save this file in the macro folder as "Calculate_Black.txt". // This macro will give the image tittle and calulates the // percentage of black pixels in an image. // Addapted from the macro Calculate_Black_to_White_Ratio.txt requires("1.32g"); if (bitDepth!=8) exit("This macro requires an 8-bit image"); title = getTitle; black = 0; white = 255; getHistogram(0, hist, 256); total = 0; for (i=0; i<256; i++) total += hist[i]; print(title,"\t", 100*hist[black]/total);