Bug 154698 - Won't open some TIFF files
Summary: Won't open some TIFF files
Status: RESOLVED INTENTIONAL
Alias: None
Product: okular
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Okular developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-27 20:07 UTC by James Richard Tyrer
Modified: 2007-12-29 10:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
TIFF file that doesn't open (345.46 KB, image/tiff)
2007-12-27 20:11 UTC, James Richard Tyrer
Details
TIFF file that does open (515.93 KB, image/tiff)
2007-12-27 20:21 UTC, James Richard Tyrer
Details
Properties (27.51 KB, image/png)
2007-12-29 03:55 UTC, James Richard Tyrer
Details
Okular with ERROR (41.76 KB, image/png)
2007-12-29 03:58 UTC, James Richard Tyrer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Richard Tyrer 2007-12-27 20:07:32 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          GCC 4.2.2 
OS:                Linux

I found a TIFF file that opens fine in GwenView but won't open in Okular.  All that I get is a box with an error message: 

Could not open file: <path>/<file>
Comment 1 James Richard Tyrer 2007-12-27 20:11:36 UTC
Created attachment 22703 [details]
TIFF file that doesn't open
Comment 2 Pino Toscano 2007-12-27 20:20:26 UTC
Gwenview opens it fine... because the file is a JPEG!

Opening with the okular TIFF backend, I get this message in the console:
  br154698.tiff: Not a TIFF or MDI file, bad magic number 55551 (0xd8ff).

And,
  $ file br154698.tiff
  br154698.tiff: JPEG image data, JFIF standard 1.01
thus:
  $ cp br154698.tiff br154698.jpeg
then both gwenview and okular (using the image backend) are able to open the image.
Comment 3 James Richard Tyrer 2007-12-27 20:21:15 UTC
Created attachment 22704 [details]
TIFF file that does open

I opened the file in The GIMP and saved it with the same type of TIFF format
and now it opens.
Comment 4 James Richard Tyrer 2007-12-27 21:11:02 UTC
Re: Comment #2

Please see second attachment.

It is possible that this is a magic number issue, perhaps it even has the wrong extension (and that does appear to be the case).

However other apps, including GwenView, Kview, KwickShow, The GIMP, Krita-1.6.3, ImagicMagick(display), etc.  KDE-3.5.x does thumbnails.

So, there is a bug even if it is not as stated.  Before modifying the bug, we need to know if the problem in Okular occurs in Okular or is caused by KDE libraries or base functions.


Comment 5 Pino Toscano 2007-12-27 22:00:18 UTC
The problem is not in Okular.

Okular just uses what KMimeTypes reports to be the mimetype of the file, and then uses the backend responsible for handling that mimetype. If the backend receives something it cannot read, it's not its fault.

To the TIFF issue: both the Qt TIFF plugin AND the okular TIFF backend use libtiff, so in case that file is really a TIFF, the problem is there.
Comment 6 Pino Toscano 2007-12-27 22:01:19 UTC
The problem is not in Okular.

Okular just uses what KMimeTypes reports to be the mimetype of the file, and then uses the backend responsible for handling that mimetype. If the backend receives something it cannot read, it's not its fault.

To the TIFF issue: both the Qt TIFF plugin AND the okular TIFF backend use libtiff, so in case that file is really a TIFF, the problem is there.
Comment 7 James Richard Tyrer 2007-12-27 22:53:42 UTC
Re: Comment #6

You seem to fail to understand what CONFIRMED means.  It means that the
reported behavior can be reproduced by another person.  Are you claiming
that you can NOT reproduce the behavior which I reported which is that
the first attachment won't open in Okular and the second attachment will?

> Okular just uses what KMimeTypes reports to be the mimetype of the
> file, and then uses the backend responsible for handling that
> mimetype. If the backend receives something it cannot read, it's not
> its fault.

That is not actually the case.  KDE is using the MIME type of the file
to determine which Okular backend to call.  So, this problem might be
caused by Okular's architecture.  Gwenview, OTOH, is directly presented
with the file and has no problem reading it.

> To the TIFF issue: both the Qt TIFF plugin AND the okular TIFF
> backend use libtiff, so in case that file is really a TIFF, the
> problem is there.

You are trying to talk down this bug rather than trying to find out
exactly what the problem is and correct it.

Modification to the KDE MIME type system might be sufficient to fix this bug, but I don't know if it is necessary.  Still, there does seem to be a bug there since the extension 'tif' overrides the Magic while if the file has no extension it is correctly identified as JPEG.
Comment 8 Pino Toscano 2007-12-27 23:14:03 UTC
> > Okular just uses what KMimeTypes reports to be the mimetype of the 
> > file, and then uses the backend responsible for handling that 
> > mimetype. If the backend receives something it cannot read, it's not 
> > its fault. 
>  
> That is not actually the case.

It's nice to see how you reject the explanation of the developers of that architecture.

> KDE is using the MIME type of the file 
> to determine which Okular backend to call.

> So, this problem might be caused by Okular's architecture.

No.
Okular asks KMimeType to determine the mimetype of the file, then it chooses which backend to call acording to what KMimeType reports.

Okular just trusts what KMimeType reports as results. No less and no more.

> Gwenview, OTOH, is directly presented with the file and has no problem
> reading it. 

... just because both TIFF and JPEG are image formats supported by gwenview.
If you do
  kfile --dialog <image>
where <image> is the first attachment, you see (Preview tab) it fails to generate the preview; while if you do that after renaming it to .jpg, the preview is rendered correctly.

Thus, I'm reassigning the problem to kdelibs (where KMimeType is), as should be KMimeType to report us the correct mimetype for it.
Comment 9 James Richard Tyrer 2007-12-29 03:47:22 UTC
Re: Comment #8

IIUC, if the KDE4 MIME system identifies the JPEG file as JPEG then Okular should open it.

Sorry, but I made some modifications to the MIME data (no file extensions for JPEG, PNG, & TIFF.  And, it still doesn't work.  So, there is a n issue somewhere in Okular.  Probably not an important one, but still an issue.
Comment 10 James Richard Tyrer 2007-12-29 03:55:47 UTC
Created attachment 22744 [details]
Properties

This clearly shows that the file which I have renamed: "not-tiff.tif" is
correctly identified as a JPEG file (which it is).
Comment 11 James Richard Tyrer 2007-12-29 03:58:46 UTC
Created attachment 22745 [details]
Okular with ERROR

Note that the ERROR says that it can't open the file: "not-tiff.tif" which the
KDE4 MIME type system correctly identified as a JPEG file.
Comment 12 James Richard Tyrer 2007-12-29 04:04:50 UTC
Since KDE Libs correctly interperts the MIME type data provided, it isn't a KDE Libs bug.
Comment 13 James Richard Tyrer 2007-12-29 04:06:03 UTC
Not important enough to worry about.
Comment 14 Pino Toscano 2007-12-29 10:20:48 UTC
Can you please post all the console output of your last attempt?