Bug 307277 - digikam corrupts MPO (3D pictures produced by the Fujifilm W3 camera) files when attempting to rotate them during import
Summary: digikam corrupts MPO (3D pictures produced by the Fujifilm W3 camera) files ...
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Import-PostProcessing (show other bugs)
Version: 3.0.0
Platform: Ubuntu Linux
: NOR critical
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-23 17:24 UTC by Vadim
Modified: 2017-08-16 05:53 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim 2012-09-23 17:24:54 UTC
The Fujifilm W3 3D camera is a compact camera that takes 3D photos. It uses the MPO format. It is documented at:
http://www.cipa.jp/english/hyoujunka/kikaku/pdf/DC-007_E.pdf

The format is an extension of JPEG, and as such it works fine in applications that read it. However writing it properly requires understanding the extensions.

The problem is twofold:

1. Digikam doesn't correctly write back the file, and corrupts it
2. It shouldn't be doing that anyway, as the 3D effect only works in the orientation it was taken -- 3D images can't be rotated. Rotation of 3D pictures should never be done automatically. If Digikam permits rotating 3D images by user request, the user should be given a warning.





Reproducible: Always

Steps to Reproduce:
1. Take picture on Fujifilm W3 3D camera (or any other camera using the MPO format)
2. Import in digikam. If digikam reports it's rotating the file, it will be broken. Corrupted files can be detected by grepping for 'digiKam'
3. Upload the file back to the camera. 
Actual Results:  
Camera will report an error if attempting to display it. In the thumbnail view, the image will be visible, but broken files will only have 2D thumbnails.


Expected Results:  
File should be copied from the camera/card unmodified, for the above explained reasons.

A 3D camera isn't required to test this bug. Sample MPO files can be obtained for instance at http://3dporch.com/

Since MPO files can't be rotated meaningfully, simply leaving the file untouched is an acceptable fix.
Comment 1 caulier.gilles 2012-09-23 18:25:27 UTC
This is something new about MPO files type...

We must ignore this format in rotation code.  Very easy...

https://projects.kde.org/projects/extragear/graphics/digikam/repository/revisions/master/entry/libs/jpegutils/jpegutils.cpp#L668

Note : to be homogeneous, some others code need to be patched in this way :

https://projects.kde.org/projects/extragear/graphics/kipi-plugins/repository/revisions/master/entry/jpeglossless/plugin/utils.cpp#L197

Smit, it's an easy bug report... Did you manage it ?

Gilles Caulier
Comment 2 Smit Mehta 2012-09-24 16:51:19 UTC
Hi Gilles

Just to be sure, the function isJpeg should return false, if it sees MPO files, correct?

Mimetype of an MPO file says JPEG only. I will get the extension from the filename. Is that fine? Or should I do anything else?

Smit
Comment 3 caulier.gilles 2012-09-24 20:39:25 UTC
>Just to be sure, the function isJpeg should return false, if it sees MPO files, correct?

Yes.

>Mimetype of an MPO file says JPEG only. I will get the extension from the filename. Is that fine? Or should I do anything else?

yes. Look how it's do in libkexiv2 for ex. :

https://projects.kde.org/projects/kde/kdegraphics/libs/libkexiv2/repository/revisions/master/entry/libkexiv2/kexiv2_p.cpp#L105

... we use this way to check if Raw file extension are supported in writing mode...

Gilles Caulier
Comment 4 Smit Mehta 2012-09-25 12:05:04 UTC
Git commit 2dde7e718f98db683d9c255bee4093302ca21d73 by Smit Mehta.
Committed on 25/09/2012 at 14:04.
Pushed by smitmehta into branch 'master'.

Adding .MPO file as an exception. Its a 3D extension of JPEG which is not supposed to be rotated.

M  +14   -1    jpeglossless/plugin/utils.cpp

http://commits.kde.org/kipi-plugins/2dde7e718f98db683d9c255bee4093302ca21d73
Comment 5 Smit Mehta 2012-09-25 12:06:45 UTC
Git commit f5ed9bdcf6729fdbdc15f1beecd61b8d0856a5b0 by Smit Mehta.
Committed on 25/09/2012 at 14:06.
Pushed by smitmehta into branch 'master'.

Adding MPO format as an exception. It is a 3D extension of jpeg which is not supposed to be rotated.

M  +7    -2    libs/jpegutils/jpegutils.cpp

http://commits.kde.org/digikam/f5ed9bdcf6729fdbdc15f1beecd61b8d0856a5b0