Login  Register

TIFF: batch LZW compression via a macro

Posted by Guenter Giese on May 20, 2015; 8:33pm
URL: http://imagej.273.s1.nabble.com/TIFF-batch-LZW-compression-via-a-macro-tp5012892.html

Dear ImageJ users,

I try to set up a macro for batch LZW compression of multiple TIFF 16bit grayscale image files.

I started with macro recording. When I opened a TIFF file from the ImageJ GUI and exported it with the BioFormats exporter as a LZW compressed TIFF, I ended up with a TIFF image with a reduced file size (1.0 MB reduced to 0.7 MB):
 open("D:\\temp2\\test3\\d1_cropxyz_z0000.tif");
 run("Bio-Formats Exporter", "save=D:\\temp2\\test3\\macro_recorder.ome.tif compression=LZW");


Now I tried to include the recorded sequence for TIFF export and LZW compression in an ImageJ macro:
 
 run("Bio-Formats Exporter", "save="+path+" compression=LZW"); //(path is defined during loading, can also be specified like above)

The image is loaded via the script, and it is subsequently saved, but with an increased file size (1.0 MB expanded to 1.7 MB), and I receive the error message: "OME-XML java library not found"

What is the cause for the difference between manual conversion via the GUI, and the loading and saving via a macro? It seems that the path to the OME-XML java library is found when using the GI, but not from inside the macro.

Is there any path variable to be set before running the LZW compression macro, or to be included in the macro code?


Thanks for any suggestion,

Guenter


--
Dr. Guenter Giese
Light Microscopy Facility Manager
Dept. of Biomedical Optics
MPI fuer Medizinische Forschung
D-69120 Heidelberg, Germany
phone xx49 or 0 -6221-486-360 fax -325
e-mail: [hidden email]

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html