[imagej] Commandline invert image

By.

min read

My profile

Share this:

For instance from fluorescent images to “normal” images. (FiSH to “normal” images):
works like this: newpixelvalue = 255 – pixelvalue

This works for single layer images as well as RGB images.

[code:1:67f0d6c4e8] /**
* Inverts image, single layer
* @author Ramon Fincken, http://www.ramonfincken.com/permalink/topic243.html
* @param fullpath
* @param write_to_png
*/
public void invert(String fullpath, String write_to_png)
{
ImagePlus img = IJ.openImage(fullpath);
ImageProcessor IP = img.getProcessor();

IP.invert();
img.setProcessor(IP);

IJ.save(img, write_to_png);
}[/code:1:67f0d6c4e8]

Share this:

Leave a Reply

Your email address will not be published. Required fields are marked *