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

Can not support using copy of raw photo as thumbnail for some photos #15

Closed
bafu opened this issue May 19, 2021 · 1 comment
Closed
Assignees

Comments

@bafu
Copy link
Contributor

bafu commented May 19, 2021

Related issue: #14

Steps to Reproduce

bafu@bafu-XPS-13-7390  ~/codes/starling-cai/utils   master  sha256sum scott.jpg 
55146f1665fa84fe2a76d13772f7f83ea02a188cde68a047cb9acd2e28005d90  scott.jpg

bafu@bafu-XPS-13-7390  ~/codes/starling-cai/utils   master  cp scott.jpg scott-thumbnail.jpg 

bafu@bafu-XPS-13-7390  ~/codes/starling-cai/utils   master  python3 starling_multiple_injection.py scott.jpg 
Traceback (most recent call last):
  File "starling_multiple_injection.py", line 173, in <module>
    photo_bytes = starling.cai_injection()
  File "/home/bafu/codes/starling-cai/cai/starling.py", line 180, in cai_injection
    cai_data_bytes = self.multiple_claims_injection()  File "/home/bafu/codes/starling-cai/cai/starling.py", line 175, in multiple_claims_injection
    cai_data_bytes = insert_xmp_key(data_bytes, store_label=self.store_label)
  File "/home/bafu/codes/starling-cai/cai/core.py", line 93, in insert_xmp_key
    metadata.write()
  File "/home/bafu/.local/lib/python3.8/site-packages/pyexiv2/metadata.py", line 127, in write
    self._image._writeMetadata()
OSError: Input data does not contain a valid image

If we create a thumbnail with smaller size, injection can be done successfully:

bafu@bafu-XPS-13-7390  ~/codes/starling-cai/utils   master  convert -resize 100x100 scott.jpg scott-thumbnail.jpg 

bafu@bafu-XPS-13-7390  ~/codes/starling-cai/utils   master  python3 starling_multiple_injection.py scott.jpg 

Raw photo

  • scott

Environment

  • starling-cai: v1.3.1
  • Python: 3.8.2
@bafu bafu mentioned this issue May 19, 2021
@bafu bafu self-assigned this May 26, 2021
@bafu
Copy link
Contributor Author

bafu commented Jun 20, 2021

This issue is fixed by v1.3.2.

There is a potential performance issue in this scenario.

The size of the example image above is ~5.7 MB, and every injection will add 2 thumbnails and increase 11.4 MB in total size. The injection takes ~28s, and my notebook CPU is 12-core Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz.

# 6-injection test

$ time python3 james_multiple_injection.py scott-1.jpg
...
python3 james_multiple_injection.py scott-1.jpg  28.37s user 28.71s system 99% cpu 57.104 total

@bafu bafu closed this as completed Jun 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant