TiffWarnings/820
TiffWarnings/820
Hi,
this may in fact be a bug but I am posting this as a question a user might have.
I got a number of "tif" files from a scientific instrument which I can display. However, I need to get access to the comments added to the tif file as they contain information about how this image was acquired (instrument parameter). I have used this on other images before so I am using
$ identify -verbose 20181107-SRC-C7-0003.tif
It prints a lot of output and when it is (in my estimate) about to print the Comments: it exits with:
Version: ImageMagick 6.7.8-9 2016-06-16 Q16 http://www.imagemagick.org
identify: Unknown field with tag 50345 (0xc4a9) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/820.
identify: ASCII value for tag "ImageDescription" contains null byte in value; value incorrectly truncated during reading due to implementation limitations. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/820.
However, in display I can see the comments in the "Image Info" function:
[a lot of information]
Properties:
comment: [TemImageFile]
nstrument Name=...
ate=11/07/18
ime=3:12:48 p
ample=
I just noticed all the comments are missing their first character ! It is Instrument not nstrument Name
Anyhow, it seems that there may be a way to get the pure comment string(s) from an image; here the user question - how can I get the comments on the command line ?
I need the comments for further processing. Normally I run something like set comment [exec -- identify -verbos $filename_tif] in a tcl script.
Is there another way? Can one ask identify to ignore errors in tags since 'display' does not seem to care ?
OS: Centos 7 I tired the above 6.7.8 and 7.0.7 on another computer with the same result.
Thanks,
Lothar
this may in fact be a bug but I am posting this as a question a user might have.
I got a number of "tif" files from a scientific instrument which I can display. However, I need to get access to the comments added to the tif file as they contain information about how this image was acquired (instrument parameter). I have used this on other images before so I am using
$ identify -verbose 20181107-SRC-C7-0003.tif
It prints a lot of output and when it is (in my estimate) about to print the Comments: it exits with:
Version: ImageMagick 6.7.8-9 2016-06-16 Q16 http://www.imagemagick.org
identify: Unknown field with tag 50345 (0xc4a9) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/820.
identify: ASCII value for tag "ImageDescription" contains null byte in value; value incorrectly truncated during reading due to implementation limitations. `TIFFFetchNormalTag' @ warning/tiff.c/TIFFWarnings/820.
However, in display I can see the comments in the "Image Info" function:
[a lot of information]
Properties:
comment: [TemImageFile]
nstrument Name=...
ate=11/07/18
ime=3:12:48 p
ample=
I just noticed all the comments are missing their first character ! It is Instrument not nstrument Name
Anyhow, it seems that there may be a way to get the pure comment string(s) from an image; here the user question - how can I get the comments on the command line ?
I need the comments for further processing. Normally I run something like set comment [exec -- identify -verbos $filename_tif] in a tcl script.
Is there another way? Can one ask identify to ignore errors in tags since 'display' does not seem to care ?
OS: Centos 7 I tired the above 6.7.8 and 7.0.7 on another computer with the same result.
Thanks,
Lothar
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: TiffWarnings/820
Those are warnings, not errors, and shouldn't cause IM to exit.
I suggest you post a link to a sample TIF file.
I suggest you post a link to a sample TIF file.
snibgo's IM pages: im.snibgo.com
Re: TiffWarnings/820
Hi,
the tif file is 6MB. Is it okay to post ? (convert -resize does get them small but the comment disappears).
Lothar
the tif file is 6MB. Is it okay to post ? (convert -resize does get them small but the comment disappears).
Lothar
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: TiffWarnings/820
6 MB is ok. But this forum does not allow direct uploads. So post your image to some free hosting service that will not modify your image such as dropbox.com and put the URL here.
What do you get from:
That should read the comment field only without showing the warnings. If there is an actual error, it will show the error.
See https://imagemagick.org/script/escape.php for %c and other information that you can access.
What do you get from:
Code: Select all
convert image.tif -quiet -format "%c" info:
See https://imagemagick.org/script/escape.php for %c and other information that you can access.
Re: TiffWarnings/820
$ convert 20181107-SRC-C7-0004.tif -quiet -format "%c" info:
# returns :
Print Size=7.060M1VLab (7650 Bottom Mount) XR41B
# returns :
Print Size=7.060M1VLab (7650 Bottom Mount) XR41B
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: TiffWarnings/820
Post your image as suggested above so that we can inspect it.
Re: TiffWarnings/820
https://www.dropbox.com/s/akxvxri8vmo4p ... 1.tif?dl=0
Sorry took me a minute to reset my dropbox password.
Sorry took me a minute to reset my dropbox password.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: TiffWarnings/820
The comment is in lines, with \r (carriage return) as the line delimiter. Many tools interpret \r by writing the next text line on the same line as the previous line.
Code: Select all
Properties:\r\n
comment: [TemImageFile]\r
Instrument Name=EM Lab (7650 Bottom Mount
Date=11/07/18\r
Time=12:57:15 p\r
Magnification=30000\r
Acc. Voltage=80.0kV\r
Lens Mode=HC-ZOOM1\r
Sample Name=SCR\r
Tilt Angle=-0.1\r
Stage X=-538.3\r
Stage Y= 421.2\r
Stage Xp=-464071\r
Stage Yp= 363095\r
Print Size=7.0\r\n
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: TiffWarnings/820
ImageMagick identify -verbose is only see the following in the properties section. So only the last part of your comment about Print Size is picked up. Note that the field "comment" is missing.
Code: Select all
Properties:
Print Size=7.095M1VLab (7650 Bottom Mount) XR41B
date:create: 2018-11-19T11:38:26-08:00
date:modify: 2018-11-19T11:38:26-08:00
signature: abb0dff6e4e659ea429a2dceeb1649d8d633b40329999bdfe1663f5f7e022078
tiff:alpha: unspecified
tiff:endian: lsb
tiff:photometric: min-is-black
tiff:rows-per-strip: 4
Re: TiffWarnings/820
Can you verify the error message ?
Is there a solution to this problem ? Again, I did not write the file I only need to extract parameters that were written as comments.
If it is \r instead of \n and if this were to output a long string in unix, I could deal with that but if identify crashes or prints nothing I cannot continue.
Thanks,
Lothar
Is there a solution to this problem ? Again, I did not write the file I only need to extract parameters that were written as comments.
If it is \r instead of \n and if this were to output a long string in unix, I could deal with that but if identify crashes or prints nothing I cannot continue.
Thanks,
Lothar
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: TiffWarnings/820
Yes, the problem is \r, and "tr" cures it.
Without "tr":
With "tr":
EDIT: to add that "-quiet" can be used to suppress the warning.
Without "tr":
Code: Select all
convert 20181107-SRC-C6-0001.tif -format "%c" info:
convert.exe: Unknown field with tag 50345 (0xc4a9) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/913.
Print Size=7.095M1VLab (7650 Bottom Mount) XR41B
Code: Select all
convert 20181107-SRC-C6-0001.tif -format "%c" info: |tr "\r" "\n"
convert.exe: Unknown field with tag 50345 (0xc4a9) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/913.
[TemImageFile]
Instrument Name=EM Lab (7650 Bottom Mount) XR41B
Date=11/07/18
Time=12:57:15 p
Magnification=30000
Acc. Voltage=80.0kV
Lens Mode=HC-ZOOM1
Sample Name=SCR
Tilt Angle=-0.1
Stage X=-538.3
Stage Y= 421.2
Stage Xp=-464071
Stage Yp= 363095
Print Size=7.0
snibgo's IM pages: im.snibgo.com
Re: TiffWarnings/820
Cool thanks !