La vidéo de Weekly Edit de cette semaine traite d’un script qui permettra à Facebook de reconnaître votre photo comme vue panorama à 360°.

Bon visionnage !

Le script:

 1#!/usr/bin/env bash
 2# Adds metadata to images so that Facebook displays them as panoramas.
 3# https://discuss.pixls.us/t/panorama-mode-in-facebook/3585
 4# By Harry Durgin and Morgan Hardwood
 5
 6if [[ ! -f ${1} ]]; then
 7    printf '%sn' "No input file specified or file not found." "Aborting."
 8    exit 1
 9fi
10
11hfov=0
12while [[ hfov -lt 100 || hfov -gt 360 ]]; do
13    read -r -p "Enter horizontal field of view (100-360): " hfov
14done
15
16for f in "${@}"; do
17    printf '%sn' "" "Processing: $f"
18
19    width="$(exiftool -T -ImageWidth "${f}")"
20    height="$(exiftool -T -ImageHeight "${f}")"
21    ratio=$((width/height))
22
23    if [[ ratio -lt 2 ]]; then
24        printf '%sn' "Image must have a ratio of at least 2:1." "Skipping."
25        continue
26    fi
27
28    width_full=$((360*width/hfov))
29    height_full=$((180*width_full/hfov))
30    height_full=$((width_full/2))
31    left_crop=$(((width_full-width)/2))
32    top_crop=$(((height_full-height)/2))
33
34    exiftool 
35        -FullPanoWidthPixels="$width_full" 
36        -FullPanoHeightPixels="$height_full" 
37        -CroppedAreaLeftPixels="$left_crop" 
38        -CroppedAreaTopPixels="$top_crop" 
39        -CroppedAreaImageWidthPixels="$width" 
40        -CroppedAreaImageHeightPixels="$height" 
41        -ProjectionType=equirectangular 
42        -UsePanoramaViewer=True 
43        "$f"
44done

Source: http://weeklyedit.com/facebook-360-view/