Re: Saving little-endian 16 bit TIFF / "save-string-to-file" macro command

Posted by Wayne Rasband on
URL: http://imagej.273.s1.nabble.com/Saving-little-endian-16-bit-TIFF-save-string-to-file-macro-command-tp3696133p3696134.html

> I am using a program (BD AttoVision) that can only read 16 bit TIFF  
> files in the "little endian" TIFF format starting with "49 49 2A  
> 00" ("II*."). However, ImageJ saves all files in the "big endian"  
> TIFF format starting with "4D 4D 00 2a" ("MM.*"). This essentially  
> nukes all my images if I open and save them from ImageJ.
>
> Please could you add an option to save little endian" TIFF files  
> and/or to preserve the format.

The v1.41d daily build saves TIFFs in little endian format if you  
enable the "Save TIFF and Raw in Intel Byte Order" option in  
Edit>Options>Input/Output.

> I use ImageJ macros to process a large number of these TIFF files  
> and I was trying to figure out a workaround to the problem  
> described above (it would have been as simple as using a regexp to  
> switch bytes). Unfortunately, there is currently no ways to handle  
> binary files (the "print(file, string)" command changes special  
> characters such as newlines).
>
> Please could you also implement binary file support (e.g. a simple  
> "save-string-to-file" command) to the macro language.

You can do this be converting the string to an image and saving the  
image in raw format.

-wayne