https://github.com/Gregor-Mendel-Institute/RKP2021-CMT3
Raw File
Tip revision: 89d7e2ea78af1969bb161640baed09296ed2485f authored by Papareddy on 23 April 2021, 11:18:44 UTC
Update README.md
Tip revision: 89d7e2e
covert_RGB_to_8bit
#this is a .ijm imageJ macros to conver RGB to 8bit image (tiff)
input = getDirectory("/Users/ranjith.papareddy/Downloads/seed_size/onlytiffs");
output = getDirectory("/Users/ranjith.papareddy/Downloads/seed_size/onlytiffs/8bit_converted");

suffix = ".tif";  //you only want to apply to tiff images, no need to ask
path = getDirectory("image");
processFolder(input);

function processFolder(input) {
  list = getFileList(input);
  for (i = 0; i < list.length; i++) {
    if(File.isDirectory(input + list[i]))   //if it's a directory, go to subfolder
    processFolder("" + input + list[i]);
    if(endsWith(list[i], suffix))   //if it's a tiff image, process it
    processFile(input, output, list[i]);
    //if it's neither a tiff nor a directory, do nothing
  }
  }



    function processFile(input, output, file) {

    print("Processing: " + input + file);

    open(input + file);

    run("8-bit");
    saveAs("tiff", output + file );

    print("Saved to: " + output);
    close();
    }
back to top