http://imagej.273.s1.nabble.com/TIFF-batch-LZW-compression-via-a-macro-tp5012892p5012906.html
> I am using Fiji. Is there any difference in using ImageJ1 instead of
ImageJ1's built in TIFF logic cannot save LZW—only read it.
Bio-Formats should not matter.
opened as a virtual stack. You would destroy the original before you finish
reading all its pixels.
new file to the original name. You can use the File.rename and File.delete
functions of the IJ1 macro language.
> Hi Curtis,
>
> You're right. When the target file name does not exist yet, the result
> tiff file is compressed.
>
> I am using Fiji. Is there any difference in using ImageJ1 instead of Fiji
> in this respect (tiff LZW compression)?
>
> Is there any way to simply replace the uncompressed TIFF source file with
> the compressed one (same name), leading to the same result as saving under
> a different name?
> Any option to be set in the BioFormats exporter?
>
>
> Thank you very much!
>
> Guenter
>
>
>
> Am 20.05.2015 um 23:02 schrieb Curtis Rueden:
>
>> Hi Guenter,
>>
>> 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)
>>>
>> If the file already exists, then Bio-Formats tries to append additional
>> data. Make sure you are saving to a file which does not already exist.
>>
>> I receive the error message: "OME-XML java library not found"
>>>
>> Hmm, not sure why that would be the case! Are you using Fiji? Or plain
>> ImageJ1?
>>
>> Regards,
>> Curtis
>>
>> On Wed, May 20, 2015 at 3:35 PM, Guenter Giese <
>>
[hidden email]> wrote:
>>
>> 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>>>
>>> --
>> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>>
>
> --
>
> ------------------------------------------
> Dr. Guenter Giese
> Light Microscopy Facility Manager
> Dept. of Biomedical Optics
> MPI fuer Medizinische Forschung Jahnstr. 29
> D-69120 Heidelberg, Germany
> Phone (+49) 6221-486-360 (Fax: -325)
>
> e-mail:
[hidden email]
>
> --
> ImageJ mailing list:
http://imagej.nih.gov/ij/list.html>