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

exifread reaturn empty tags object #35

Closed
Nippey opened this issue Mar 21, 2014 · 21 comments
Closed

exifread reaturn empty tags object #35

Nippey opened this issue Mar 21, 2014 · 21 comments
Labels

Comments

@Nippey
Copy link

Nippey commented Mar 21, 2014

Hi,

I tried your ExifRead on my Synology on two different images, that both contain tags if read with exiftool.

What details can I provide you?

Linux Synology_NAS 3.2.40 #3810 SMP Wed Nov 6 05:13:41 CST 2013 armv7l GNU/Linux synology_armadaxp_ds214+

Python 3.3.2 (default, Dec 23 2013, 16:12:02)
[GCC 4.6.4] on linux

EXIF.py Ver 1.4.2

BR
Nippey

@nickyoung23
Copy link

I get the same, zero tags returned, no error thrown. Testing on a Windows machine before deploying on Synology box. Python 3.3.5, exifread 1.4.2.

@ianare ianare added the bug label Apr 21, 2014
@v-python
Copy link

v-python commented Jun 7, 2014

Likewise. "No EXIF information found" when it is in there, according to IrfanView.

http://nevcal.com/xB/20050719-182532gl_c.jpg is an example image on which the failure occurs.

Version 1.0.10 of EXIF.py, does work better, in that it attempts to find something, but fails to decode it to ASCII... turning on debug here is the traceback I get from version 1.0.10, although that is, admittedly, a version I ported to Python 3, and submitted the patches for Python 3 support, which seem to have been integrated... maybe I missed something, but that version at least found the EXIF data in the file, whereas this version doesn't.

debug: ResolutionUnit: (0x0128) Short=Pixels/Inch @ 32646
debug: JPEGInterchangeFormat: (0x0201) Long=32694 @ 32658
debug: JPEGInterchangeFormatLength: (0x0202) Long=8724 @ 32670
debug: RecordingMode: (0x0001) Byte= @ 196608
Traceback (most recent call last):
File "d:\my\py\exif.py~", line 1792, in
data = process_file(file, stop_tag=stop_tag, details=detailed, strict=strict
, debug=debug)
File "d:\my\py\exif.py~", line 1726, in process_file
hdr.decode_maker_note()
File "d:\my\py\exif.py~", line 1570, in decode_maker_note
dict=MAKERNOTE_CASIO_TAGS)
File "d:\my\py\exif.py~", line 1381, in dump_IFD
values = values.decode('ASCII')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf3 in position 0: ordinal
not in range(128)

@v-python
Copy link

v-python commented Jun 7, 2014

P.S. I was using Windows 7, Python 3.3.1, EXIF 1.4.2 and EXIF 1.0.10.

@danzemke
Copy link

This simple script works with Python2 but returns an empty dictionary for Python3.41:

#!python3
import exifread
path_name = 'P:\testPhotos\DCIM\100CANON\IMG_0772.JPG'
f = open(path_name, 'rb')
tags = exifread.process_file(f)
print(tags)

@nlfiedler
Copy link

Same for me on Python 3.3.3 on Mac OS X with exifread 1.4.2. Images clearly have EXIF data but exifread is returning nothing.

@spectras
Copy link

spectras commented Sep 6, 2014

The exifread version I have is 1.4.2 as well, and is not pyhon3 ready.
It simply breaks when examining the file, failing to detect the JPEG header, because it compares what it read (a bytes objects) to a string, which always fails.

I guess I should try to get a development version to see what happens, but if python3 support was included, it would be great to release a new version.

@H0L0GH05t
Copy link

Python 2.6, exifread 1.4.2

Image has EXIF data and I can get it using pillow, but exifread returns nothing.

@ianare
Copy link
Owner

ianare commented Nov 18, 2014

Please try with latest development version, I was able to extract info from the sample image provided: http://nevcal.com/xB/20050719-182532gl_c.jpg

If you are still having errors, please upload or link to failing image.

Thank you.

@nlfiedler
Copy link

👍 Works for me. Thanks!

@ianare
Copy link
Owner

ianare commented Nov 19, 2014

OK cool :-)

@ianare ianare closed this as completed Nov 19, 2014
@H0L0GH05t
Copy link

I tested it out and it doesn't work with the image I got from an encrypted zip, but it works fine with normal images. I guess I just have to not use encrypted files somehow... Thanks though!

@ianare
Copy link
Owner

ianare commented Nov 19, 2014

Can you upload a failing image for testing?

Even if the info is unreadable it shouldn't fail...

Thanks!

@ianare ianare reopened this Nov 19, 2014
@H0L0GH05t
Copy link

36253

Here is the image that is failing. I tried to encrypt an image myself and run my test script, but it still worked. This image just won't work, even if I decrypt it. You can see it does have metadata for several fields. I'm not sure what is causing this to fail now...

@ianare
Copy link
Owner

ianare commented Nov 19, 2014

It doesn't look like that image has any valid Exif tags. It has a 'JFIF' marker tag, but that's all I could find.

It does however have XMP tags, which some metadata readers will interpret and display as if they were Exif tags.

I am currently working on adding (very) basic XMP info, just an XML dump initially. I'd like to have this for the 2.0 release.

@H0L0GH05t
Copy link

Ah, I see. So then seeing them come up using other libraries was because they were pulling the XMP info and reading it as if they were EXIF? Ok then. I'd definitely like to see that then in an upcoming release (hopefully with python 3.4 support?). Thanks!

@ianare
Copy link
Owner

ianare commented Nov 19, 2014

Yes, that's right.

Dumping the XMP info in raw XML isn't too complicated, if a bit of chore as in most case it could be almost anywhere in the file. Processing the tags from the retrieved XML though, that looks like quite a pain.

In any case, the latest Git version is already passing all python 3.4 tests. Try it out!

@H0L0GH05t
Copy link

Ok then. Thank you for your help! 👍

@ianare ianare closed this as completed Nov 19, 2014
@irdroid3
Copy link

As a dumb user, here is a hint for other dumb users...
I also had the UnicodeDecodeError error -

UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 668: character maps to

This is because I passed the file object after doing -

f = open(join(dirName,fname))

Change this to -

f = open(join(dirName,fname),'rb')

and there is no decode performed !!!! - works for me now...

@irdroid3
Copy link

Weird - open the file (as above), then 👎
exif = exifread.process_file(f)
The list of tags in the exif variable comes out in a different order each run...

@v-python
Copy link

On 4/22/2015 7:15 AM, irdroid3 wrote:

Weird - open the file (as above), then 👎
exif = exifread.process_file(f)
The list of tags in the exif variable comes out in a different order
each run...

That's because it isn't sorted, and Python hashes are randomized each
run as a security measure against DoS attacks on servers.

Probably would be a reasonable idea for exifread to sort the output,
which would make the order consistent.

@ianare
Copy link
Owner

ianare commented Apr 24, 2015

There is a branch somewhat in progress that would arrange the output as a multidimensional list, for sorting and easier access. But this would break backwards compatibility, so would need to be made an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

9 participants