How do you suppress TIFFWarnings?

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Keith.Vinson
Posts: 22
Joined: 2017-08-30T12:59:12-07:00
Authentication code: 1151

How do you suppress TIFFWarnings?

Post by Keith.Vinson »

Hi All,
Is it possible to suppress TIFFWarnings being bubbling up from inside ImageMagick as Exceptions?
Specifically the following "error" is occuring from inside Magick.Net:
"tiff.c/TIFFWarnings/999/Exception ASCII value for tag "Software" does not end in null byte. `TIFFFetchNormalTag'"

Thanks for any guidance you can provide...
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: How do you suppress TIFFWarnings?

Post by dlemstra »

Which version are you using and can you provide a link to your file and a small sample that I can use to reproduce the issue? A warning should normally be ignored so I don't understand why you are getting that exception.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do you suppress TIFFWarnings?

Post by fmw42 »

In command line mode, you need -quiet to suppress unknown TIFF meta field warnings. I am not sure what the equivalent is in Magick.NET
Keith.Vinson
Posts: 22
Joined: 2017-08-30T12:59:12-07:00
Authentication code: 1151

Re: How do you suppress TIFFWarnings?

Post by Keith.Vinson »

Hi All,
I'm using 7.4.3 Q8 anyCPU. The warnings are bubbling up from Magick.NET and are being labeled as Exceptions in the delegate chain.
Here is my handler:
private void MagickNET_Log (object sender, LogEventArgs e)
{
// write to a single log file...
if ((RemoteImageMagickEventLogging & e.EventType) != LogEvents.None)
{
switch (e.EventType)
{
case LogEvents.Exception:
if (!e.Message.Contains ("TIFFWarnings"))
TriggerRemoteLoggingEvent (e.EventType, EZLogger.LoggingLevel.Note1, e.Message);
break;
}
}
}

What you can see is that the EventType is being flagged as an Exception, even though it is only a warning.
I had to add a filter to srtip all TIFFWarnings out of the event chain as a quick patch. I was hoping there might be a way to suppress the warnings or to at least have them be flagged only as warnings...

I will try and post an image file for you once I identify a good candidate...
Keith.Vinson
Posts: 22
Joined: 2017-08-30T12:59:12-07:00
Authentication code: 1151

Re: How do you suppress TIFFWarnings?

Post by Keith.Vinson »

HI All, Just a quick check I have updated to version 7.4.5 Q8 AnyCPU and the issue is still occuring.
The message field now contains the string""2018-05-08T18:51:07-05:00 7:58.951 17.813u 7.0.7 Exception ImageProcessingServer.exe[26024]: tiff.c/TIFFWarnings/1000/Exception\n ASCII value for tag "Software" does not end in null byte. `TIFFFetchNormalTag'""

Here is a sample file:
http://dlsg.com/downloads/Samples/00000193_000004.tif

Thanks for the previous replies...
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: How do you suppress TIFFWarnings?

Post by dlemstra »

When an exception is thrown in the C# code there is a check to determine if warnings should be raised as an exception or should be ignored. But when an exception is created this will always be logged and that is why the message ends up in the log. You will need to add your own filter as you did.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply