ImageJ Fiji Bio-Formats Extract TIFF Metadata from SEM image

Hi All,

I am having an issue attempting to extra just the Brightness and Contrast of a FEI SEM image using the Bio-Format plugin on ImageJ. I attempted to use Ext.getMetadataValue(field, value) and input what the Bio-Format said is the name of ‘brightness’ in the Metadata but I keep getting an error saying it doesn’t recognize that.

Am I able to use that command to extra 1 single field or am I using it incorrectly?

I’m simply trying to know what Brightness and Contrast a series of images had and the plethora of information mixed in with just those two is making it difficult to batch.

Thank you for your time and possible help!

Hi Jaime,

Not clear on exactly what you are looking for here when you say you want to extract the brightness and contrast of an image. For light microscopy images, i tend to use the getMinAndMax(min, max) macro command, but i also tend to set my brightness and contrast somewhat arbitrarily.

Does that get you what you are looking for?


Hi Wilson,

First off thanks for your reply. To clarify my question; I have (for instance) 10 images that are of the same type of feature (Semiconductor devices) and the images are roughly around the same Brightness and Contrast (Lets say Brightness = 50±10 and Contrast = 50±10). I want to be able to import in the photo(s) and have BioFormats extract just the Values of the brightness and contrast and print it out to me. So “Brightness = 45.9991 , Contrast = 58.1123”. Does that clarify things at all?

Thanks for your input!

Hi @jamie.rodgers , you should be able to use that command ok. What is the exact command you are using and what is the metadata name? Have you initialised the file with Ext.setId first?

Hi there,

I extracted the exact metadata name to be “[STEM 3+] Brightness” and “[STEM 3+] Contrast”
I attempted to use this command using the exact name.
Ext.getMetadataValue("[STEM 3+] Brightness", val);

I am not sure how to use the Ext.setId in this instance, can you elaborate?

Thank you!

Sure, before you can read the metadata you need to initialise the Bio-Formats reader with the file you reading such as below:

run("Bio-Formats Macro Extensions");
Ext.getMetadataValue("[STEM 3+] Brightness", brightness)
print("Brightness = " + brightness)
Ext.getMetadataValue("[STEM 3+] Contrast", contrast)
print("Contrast = " + contrast)

So I am continuing to get an error int the compiler at line 4 the error states ') ’ expected in line 4 . getMetadataValue ("[STEM 3+] Brightness" , brightness)

Is it possible the parenthesis in the [STEM 3+] is causing issue?

I tested with that exact string but did not get any errors. Do you have the exact code sample you are using?

I didn’t change much as this is very introductory to me:


(“Bio-Formats Macro Extensions”);


Ext.getMetadataValue(“STEM 3+ Brightness”, brightness );

print("Brightness of Image = " + brightness)

Ext.getMetadataValue("[STEM 3+] Contrast", contrast );

print("Contrast of Image = " + contrast)


Ah, it looks as though the quotation marks used are different for the setId and getting the brightness, try the below:

run("Bio-Formats Macro Extensions");
Ext.getMetadataValue("STEM 3+ Brightness", brightness );
print("Brightness of Image = " + brightness)
Ext.getMetadataValue("[STEM 3+] Contrast", contrast );
print("Contrast of Image = " + contrast)