Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.arw files not supported? #3124

Closed
alexisgaziello opened this issue May 7, 2018 · 6 comments
Closed

.arw files not supported? #3124

alexisgaziello opened this issue May 7, 2018 · 6 comments
Projects

Comments

@alexisgaziello
Copy link

alexisgaziello commented May 7, 2018

What did you do?

I have been using the library to get the image creation date and everything was working perfect until I switched from .jpg to .arw format (my sony alpha camera saves the raw files with this format).

What did you expect to happen?

Get my exif tag as always.

What actually happened?

The python script could not open the image. However, when inspecting the file with other apps there are no problems getting exif data.

What versions of Pillow and Python are you using?

Python 3.6.5
Pillow 5.1.0

Code:

photoDateStr=Image.open(pathToImage)._getexif()[36867][-8:]

Error:

 File "/Users/...photos.py", line 99, in tri_photos
    photoDateStr=Image.open("/Volumes/.../_DSC0006.ARW")._getexif()[36867][-8:]
  File "/usr/local/lib/python3.6/site-packages/PIL/Image.py", line 2590, in open
    % (filename if filename else fp))
OSError: cannot identify image file '/Volumes/.../_DSC0006.ARW'
@radarhere
Copy link
Member

Pillow does not currently support ARW. See the list of supported formats - http://pillow.readthedocs.io/en/5.1.x/handbook/image-file-formats.html

If you would like to create a PR to add support - http://pillow.readthedocs.io/en/5.1.x/handbook/writing-your-own-file-decoder.html - that would be considered, but unfortunately, the maintainers of Pillow do not have an abundance of time when it comes to adding new functionality.

@johns1c
Copy link

johns1c commented Sep 3, 2023

It is interesting that Pillow does NOT identify them as TIFF.

They do contain a lot of standard tags including the date, image size and resolution. EXIF data is in the file but not a TIFF standard and of course the standard TIFF image formats are not used. Lots of RAW files seem to use the approach so a generic RAW plugin could be of use.

Is there an existing plugin that could be used as a model?

@radarhere
Copy link
Member

radarhere commented Sep 3, 2023

If you're asking where Pillow processes TIFF images, it is at https://github.com/python-pillow/Pillow/blob/main/src/PIL/TiffImagePlugin.py

If you're wondering how the user gets to EXIF data in there,

def getexif(self):

retrieves
class TiffImageFile(ImageFile.ImageFile):
format = "TIFF"
format_description = "Adobe TIFF"
_close_exclusive_fp_after_loading = False
def __init__(self, fp=None, filename=None):
self.tag_v2 = None

Do you have an ARW file that you could attach here? Ideally, one that could be added to Pillow's test suite and distributed under Pillow license.

@johns1c
Copy link

johns1c commented Sep 9, 2023 via email

@radarhere
Copy link
Member

The width and height are not the only problems.

If I temporarily hardcode in the width and height of the image to work around the need for ImageWidth and ImageHeight, TiffImagePlugin then raises "SyntaxError: unknown pixel mode" on (b'II', 6, (1,), 1, (1, 1, 1), ()). It thinks it is a YCbCr image. exiftool thinks the PhotometricInterpretation is not YCbCr (6), but actually CFA (32803), which makes more sense given it is also seen in another raw format, DNG.

@radarhere
Copy link
Member

Closing as part of #6482

Pillow automation moved this from Icebox to Closed Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Pillow
  
Closed
Development

No branches or pull requests

4 participants