Skip to content

Commit 7a58f06

Browse files
authored
feat: support the format used in Google Photos which utilizes XMP metadata (#43)
* chore(deps): add python-xmp-toolkit * chore(deps): update deps * feat(cli): add xmp command * feat(cli): run wsl if exempi error * fix: update wsl command * fix(cli): fix wsl install * fix(cli): fix suffix not specified in NamedTemporaryCode, fix image widths, do not print xmp result as it is too long * chore(license): update license * docs(readme): update README.md * docs(readme): update README.md * docs(readme): update README.md * docs(readme): update README.md
1 parent a7d64a8 commit 7a58f06

5 files changed

Lines changed: 299 additions & 138 deletions

File tree

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
21
MIT License
32

43
Copyright (c) 2024 34j
4+
Copyright (c) 2018 temoki (<- the code for the xmp command in cli.py, this text is not part of the original copyright notice)
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ v1c lr left.jpg right_dir
7373
v1c lr left_dir right.jpg
7474
```
7575

76-
It is recommended to synchronize the clocks of the cameras before shooting. However, it can be adjusted by specifying `-ac` option.
76+
Since clocks on cameras may not be very accurate in some cases, it is recommended to check how quickly the clocks of the two cameras shift, and synchronize the clocks before shooting.
77+
However, it can be adjusted by specifying `-ac` option.
7778

7879
```shell
7980
v1c lr left.jpg right_dir -ac 1 # the clock of the right camera is 1 second faster / ahead
@@ -124,6 +125,32 @@ If the camera is mounted upside down, you can simply use the `--swap` option wit
124125
v1c lr left.jpg right.jpg --swap
125126
```
126127

128+
Or the image can be simply swapped using the `swap` command:
129+
130+
```shell
131+
v1c swap rl.jpg
132+
```
133+
134+
in case one notices that the left and right images are swapped after the conversion.
135+
136+
### Convert to Google's format (Photo Sphere XMP Metadata)
137+
138+
This format is special in that it base64-encodes the right-eye image into the metadata of the left-eye image.
139+
Required for Google Photos, etc.
140+
141+
You can convert the image to this format by:
142+
143+
```shell
144+
v1c xmp lr.jpg
145+
```
146+
147+
The [python-xmp-toolkit](https://github.com/python-xmp-toolkit/python-xmp-toolkit) used in this command requires [exempi](https://libopenraw.freedesktop.org/exempi/) to be installed. Note that if this command is called on Windows, it will attempt to install this library and its dependencies and then run the command on WSL using `subprocess`.
148+
149+
#### References
150+
151+
- [imrivera/google\-photos\-vr180\-test: Test for XMP metadata parsing for VR180 pictures in Google Photos](https://github.com/imrivera/google-photos-vr180-test)
152+
- [temoki/make_vr180photo_py: 左眼カメラ画像と右眼カメラ画像を結合して VR180 3D フォトを作成する Python スクリプト](https://github.com/temoki/make_vr180photo_py)
153+
127154
### Custom conversion model
128155

129156
You can also specify the conversion model by adding Python code directly to the `--transformer` option:
@@ -197,17 +224,31 @@ In anaglyph images,
197224

198225
This program cannot read RAW files. To deal with white-outs, etc., it is required to process each image with a program such as Photoshop, Lightroom, [RawTherapee](https://rawtherapee.com/downloads/), [Darktable](https://www.darktable.org/install/), etc.
199226

200-
However, this is so exhaustive, so it is recommended to take the images with jpeg format, being careful not to overexpose the images, and convert them with this program, then use Lightroom, [RawTherapee](https://rawtherapee.com/downloads/), [Darktable](https://www.darktable.org/install/) or other software to adjust colors and exposure, etc.
227+
However, this is so exhaustive, so it is recommended to take the images with JPEG format with care to **avoid overexposure** and to **match the settings** of the two cameras, then convert them with this program and edit the converted images.
228+
229+
<details>
230+
<summary>Example of editing in RawTherapee (Light editing)</summary>
231+
232+
1. Rank the left images in RawTherapee.
233+
2. Use this program to convert the images.
234+
3. Edit the converted images in RawTherapee.
235+
236+
</details>
237+
238+
<details>
239+
<summary>Example of editing in Photoshop (Exquisite editing)</summary>
201240

202-
#### Example of processing in Photoshop (Exquisite editing)
241+
1. Rank the left images in RawTherapee or Lightroom.
242+
2. Open left image as a Smart Object `LRaw`.
243+
3. Add right image as a Smart Object `RRaw`.
244+
4. Make **minimal** corrections just to match the exposure using `Camera Raw Filter`.
245+
5. Make each Smart Object into Smart Objects (`L`, `R`) again and do any image-dependent processing, such as removing the background.
246+
6. Make both images into a single Smart Object (`P`) and process them as a whole.
247+
7. Export as a PNG file.
248+
8. Hide the other Smart Object (`L` or `R`) (created in step 3) in the Smart Object `P` (created in step 4) and save the Smart Object `P`, then export as a PNG file.
249+
9. Use this program to convert the images.
203250

204-
1. Open one of the images just for specifying the canvas size.
205-
2. Add each image as Smart Objects (`LRaw`, `RRaw`) and make **minimal** corrections to match the exposure using `Camera Raw Filter`.
206-
3. Make each Smart Object into Smart Objects (`L`, `R`) again and do any image-dependent processing, such as removing the background.
207-
4. Make both images into a single Smart Object (`P`) and process them as a whole.
208-
5. Delete the background image created in step 1.
209-
6. Export as a PNG file.
210-
7. Hide the other Smart Object (`L` or `R`) (created in step 3) in the Smart Object `P` (created in step 4) and save the Smart Object `P`, then export as a PNG file.
251+
</details>
211252

212253
## Contributors ✨
213254

0 commit comments

Comments
 (0)