Panorama mode in Facebook

Spent the morning working on this, so I thought I’d share

  • Photo needs to be landscape orientation with at least a 2:1 ratio.
  • Uploading in high resolution is best. It appears that Facebook disables downloading in 360 view mode, so your high resolution version should be safe, but I can’t guarantee it.
  • Photo metadata needs to describe it as a panorama (you can use my code below)
  • You’ll need exiftool (available here http://www.sno.phy.queensu.ca/~phil/exiftool/)
  • Should work on Linux, Mac and Windows
#!/bin/bash
file=$*
echo -n 'Horizonal View in degrees (100-360): '
read hor_view
width=`exiftool -S -ImageWidth "$file" |cut -d' ' -f2`
height=`exiftool -S -ImageHeight "$file" |cut -d' ' -f2`
let width_full=$((360*$width/$hor_view))
let height_full=$((180*$width_full/$hor_view))
let height_full=$(($width_full/2))
let left_crop=$((($width_full-$width)/2))
let top_crop=$((($height_full-$height)/2))
exiftool -FullPanoWidthPixels=$width_full \
-FullPanoHeightPixels=$height_full \
-CroppedAreaLeftPixels=$left_crop \
-CroppedAreaTopPixels=$top_crop \
-CroppedAreaImageWidthPixels=$width \
-CroppedAreaImageHeightPixels=$height \
-ProjectionType=equirectangular \
-UsePanoramaViewer=True \
"$file"
2 Likes

Very cool Harry! I switched your script to be a code block. Can I add it to our pixls script repo?

Sweet! Thanks for sharing @harry_durgin! :smiley:

(I edited your post to include back-tics to ‘fence’ the code - this causes it to render properly as code). (@paperdigits beat me to it!)

Thank you and yes please

@harry_durgin cool!

I rewrote the script using proper Bash and adding safeguards, it’s available here:

2 Likes

This is fantastic. Thank you so much Morgan… I also love the idea of multiple file inputs.

2 Likes

Thank you for bringing the solution up! I saw this picture mode a long time ago on Facebook but never dug into how to do it. I confirm that the above works. Now I can post photos of my food in 360°.

3 Likes