Imageplus cannot save properties into tif file and reload it

I want to write a text info to tif file from an imageplus object, then save tif file:

aDownsampleTifFile = 'D:\QMDownload\5\fewwee_downsample.tif';
ips=ij.IJ.openImage(aDownsampleTifFile); ips.show;
ips.setProperty('downSampleFactor','5');
ij.IJ.save(ips,aDownsampleTifFile);
ips.close

The I read the info:

ips=ij.IJ.openImage(aDownsampleTifFile); ips.show;
ips.getProperty('downSampleFactor')
ans =

     []

The result is empty, not the info I write just now.

I got an answer from here.

Kota Community Forum Team member

Oct '18

Just now found that the exact answer is still not here. For the people who will have a similar question and arrived at this thread, here is my suggestion.

from ij import IJ
imp = IJ.getImage()
imp.setProperty("Info", "Filter:myFilter_v1,2")

The file saved will not lose this info (String only). Loading the file later. you can retrieve the info from the loaded ImagePlus by

infostr = imp.getInfoProperty()
1 Like