Editing 360 Photos & Injecting Metadata - Eric Cheng

Editing 360 Photos & Injecting Metadata

Articles

Originally published June 8, 2016. Edited July 29, 2016 to include information about cylindrical panoramas.

On June 9, 2016, Facebook announced support for 360 photos and panoramas. When you upload a 360 photo or panorama, Facebook automatically processes the photo and presents it in an interactive viewer. To recognize such photos upon upload, Facebook looks for camera-specific metadata found in photos taken using 360-ready cameras. This information is embedded in photo’s XMP (Extensible Metadata Platform) and/or Exif (Exchangeable image file format) tags, and if you’re sharing 360 photos or panos straight from cameras or smartphones, Facebook automatically does the right thing—you don’t need to do anything extra: just pull the image files from the camera (either on your smartphone or computer), and share them to Facebook. Panoramas taken with smartphones that have native panorama-capture support will also be presented in an interactive viewer (although you obviously won’t be able to look around in full 360).

Editing 360 Photos and Injecting Metadata

You may decide that you’d like to edit a 360 photo using your favorite image-editing program like Adobe Photoshop or iPhoto, or any number of photo editors on iOS / Android. When you open a 360 photo in an image editor, you’ll notice that the photo is likely in equirectangular projection at a 2:1 landscape aspect ratio.

Viewed as a normal picture, 360 photos are typically in equirectangular projection.

You can edit these photos for color and content as you would any other photo and save them back out as jpgs (although things get tricky if you are editing in areas close to the top, bottom, or sides, and other artifacts can creep in if you are doing things like sharpening). However, when you share edited photos, Facebook might not recognize them as being 360 photos. The reason for this is that many image editors strip out camera metadata, and the identifiers that Facebook uses to trigger 360 processing are no longer there. To solve this problem, you need to inject the metadata back into the edited file. Pro tip: Adobe Photoshop’s “Save As” feature preserves camera metadata, where as “Export As” and “Save for Web” do not. A way to bypass all of this metadata discussion is to simply use “Save As” in Photoshop.There isn’t yet a standard for tagging a photo as containing 360 content. Instead, there are two sets of metadata tags Facebook looks for to determine whether a photo is in 360:

  1. Photo Sphere XMP Metadata
    Most 360 cameras and panorama-generation tools include Photo Sphere metadata in saved photos.
  2. Camera Make and Model

Injecting Photo Sphere XMP Metadata into your 360 Photo (recommended)

Full, spherical 360 photos almost always use equirectangular projection. 360 Photos must fulfill the following requirements for Facebook to process them properly:

  1. The photo must have a 2:1 aspect ratio, with maximum file dimensions of 6000 x 3000 pixels
  2. The Exif XMP tag, “ProjectionType=equirectangular”

Most photographer-targeted Exif editors do allow the editing of the Exif XMP tag “ProjectionType,” but if you’re technical, you can use the popular command-line tool, exiftool.

exiftool -ProjectionType="equirectangular" photo.jpg
# 'photo.jpg' is the photo you want to tag

When you’re done editing metadata, use the web version of Facebook to do your 360 upload.

Injecting Make and Model Metadata into your 360 photo

If you don’t have access to exiftool, you can tag your image with Make and Model, which are fields that are able to be edited by most Exif editors that were written for photographers.As an example, let’s look at Exif information from 360 photos taken with two popular 360-ready cameras, the Ricoh Theta S and the LG 360 CAM.

Using eXif.er (http://thexifer.net), a free, web-based tool for viewing and editing image metadata, to look at photos taken by 360-ready cameras.

When you edit and save a 360 photo using standard image-editing tools, the “Make” and “Model” fields (among others) could now be empty. The easiest way to re-tag your images for 360 treatment in Facebook is to put the original values for “Make” and “Model” back into those fields. To find the original values, you can view the Exif data from an original, unedited photo taken using your 360-ready camera. If you know what you’re doing, you can re-create or copy over Photo Sphere XMP metadata. This is the preferred method, but is much more difficult to do.

What if I stitched the 360 photo myself, or don’t know what kind of camera was used?

If you created your own 360 photo or don’t happen to know the Make and Model of the camera used to capture your photo, can simply set ProjectionType to “equirectangular,” or use an known 360 camera’s values as a trigger. For example, setting Make to “RICOH” and Model to “RICOH THETA S” will work to get 360 treatment in Facebook, as long as the image’s aspect ratio is 2:1.

What about non-360 panoramas?

Metadata tags are also used to identify panoramas shot by pano-ready cameras, including smartphones with panorama shooting built in. These panoramas are usually in cylindrical projection, which is different than the equirectangular projection used to represent spherical, full-360 photos. The Exif techniques on this page will also (mostly) work when applied to edited, cylindrical panoramas that you want to be processed as panos by Facebook. For example, if you took a panorama with an iPhone 6s and then edited the panorama in a tool that stripped metadata, you’d want to add “Apple” as the Make and “iPhone 6s” as the model for the panorama to work again.Working with non-360 panoramas is complicated because metadata for panoramas must also specify things like coverage, so the metadata injection methods outlined here may not always work perfectly. There are two recommended methods for working with cylindrical panoramas: 1. If you shot the original image with a smartphone and lost the metadata when editing, copy all of the metadata from your original panorama into your edited panorama using exiftool (see below).2. If you have original, panoramic artwork or panoramas with no metadata (e.g., scans of old panoramas shot with film), you can use Facebook’s Photoshop templates to create panoramas with the correct metadata already injected.

Using Templates to create 360 photos and panoramas

Facebook’s Photoshop templates can be used to create 360 photos and panoramas without inject metadata. Cylindrical panorama templates are described by horizontal field of view (FOV) and vertical FOV, and there is also a full spherical (equirectangular) template available. Choose the template that most matches your intended fields of view, conform your picture into the template’s image dimensions, and use Photoshop’s “Save As…” to save a JPG.

This fantastic, 360º cylindrical panorama created by artists Kozyndan was created to be viewed in the Facebook interactive viewer by pasting it into a Photoshop template and saving it out as a JPG.

If you’d prefer to use exiftool to inject cylindrical panorama metadata, you can use the following commands:

# 120º h_fov, 86º v_fov
exiftool -FullPanoWidthPixels=18000 -FullPanoHeightPixels=9000 -CroppedAreaLeftPixels=6000 -CroppedAreaTopPixels=2350 -CroppedAreaImageWidthPixels=6000 -CroppedAreaImageHeightPixels=4300 -ProjectionType=cylindrical file.jpg 
# 150º h_fov, 86º v_fov
exiftool -FullPanoWidthPixels=14400 -FullPanoHeightPixels=7200 -CroppedAreaLeftPixels=4200 -CroppedAreaTopPixels=1880 -CroppedAreaImageWidthPixels=6000 -CroppedAreaImageHeightPixels=3440 -ProjectionType=cylindrical  file.jpg
# 180º h_fov, 86º v_fov
exiftool -FullPanoWidthPixels=12000 -FullPanoHeightPixels=6000 -CroppedAreaLeftPixels=3000 -CroppedAreaTopPixels=1567 -CroppedAreaImageWidthPixels=6000 -CroppedAreaImageHeightPixels=2867 -ProjectionType=cylindrical file.jpg 
# 240º h_fov, 86º v_fov
exiftool -FullPanoWidthPixels=9000 -FullPanoHeightPixels=4500 -CroppedAreaLeftPixels=1500 -CroppedAreaTopPixels=1175 -CroppedAreaImageWidthPixels=6000 -CroppedAreaImageHeightPixels=2150 -ProjectionType=cylindrical file.jpg 
# 300º h_fov, 86º v_fov
exiftool -FullPanoWidthPixels=7200 -FullPanoHeightPixels=3600 -CroppedAreaLeftPixels=600 -CroppedAreaTopPixels=940 -CroppedAreaImageWidthPixels=6000 -CroppedAreaImageHeightPixels=1720 -ProjectionType=cylindrical  file.jpg
# 360º h_fov, 86º v_fov
exiftool -FullPanoWidthPixels=6000 -FullPanoHeightPixels=3000 -CroppedAreaLeftPixels=0 -CroppedAreaTopPixels=783 -CroppedAreaImageWidthPixels=6000 -CroppedAreaImageHeightPixels=1433 -ProjectionType=cylindrical file.jpg
# 360º h_fov, 65º v_fov
exiftool -FullPanoWidthPixels=6000 -FullPanoHeightPixels=3000 -CroppedAreaLeftPixels=0 -CroppedAreaTopPixels=958 -CroppedAreaImageWidthPixels=6000 -CroppedAreaImageHeightPixels=1083 -ProjectionType=cylindrical file.jpg

What’s the largest 360 photo I can upload?

The largest 360 photo you should upload is 6000 x 3000 pixels (18 megapixels). You can upload larger photos, but there are diminishing returns past that size, and you will probably not see an appreciable difference in output.

I made my own 360 photo and followed your instructions. Why does my 360 photo look so strange?

Facebook honors some metadata tags that do things like specify field of view. 360 photos should have all of this extra metadata removed before upload unless you really know what you are doing. The easiest way to remove all metadata from an image is to use exiftool (see below), but you can also use web- or app-based Exif editors to find and remove extra metadata.

Editing Exif Tags

Using a Web-based Exif Editor

An excellent and free web-based tool for viewing and editing Exif is the eXif.er, which is used in the examples above. The eXif.er allows you to upload; view, edit, and save metadata; and download your modified image.

Using a Standalone Exif Editor

There are many standalone Exif editors for Windows and OS X. Windows users can use ExifToolGUI, which is free and fully-featured. Mac users can search for “exif editor” in the Mac App Store, where there are a few options for purchase.

Using exiftool (Technical)

The most powerful and flexible Exif editor, especially for batch processing of images, is the command-line tool, exiftool. If you are interested in using exiftool to manually tag 360 photos, install it on your machine. There’s a standalone version of exiftool for Windows, but it’s more complicated for Mac users. Then, simply use the following terminal command to insert the appropriate metadata:

exiftool -Make="camera_make" -Model="camera_model" photo.jpg
# replace 'camera_make' and 'camera_model' with the appropriate values
# 'photo.jpg' is the photo you want to tag

For example, if you’re on a Mac and you want to inject metadata for a Ricoh Theta S into a file called “bestphoto.jpg” on your Desktop, you would use the following command:

exiftool -Make="RICOH" -Model="RICOH THETA S" ~/Desktop/bestphoto.jpg

To remove all Exif from a given file called “photo.jpg” (remember to re-inject camera Make and Model before you upload):

exiftool -all= photo.jpg

To copy all Exif from one file (“source.jpg”) to another (“dest.jpg”):

exiftool -TagsFromFile source.jpg "-all:all>all:all" dest.jpg

Advanced Topics

Editing Equirectangular Projections

Using a standard image editor to edit equirectangular projections can be extremely challenging. You’re editing pixels in a non-linear space that contains a lot of distortion. Here are a couple hints for successful editing.

Useful software and plugins

Two extremely useful Adobe Photoshop additions for editing 360 photos are Flexify 2 for Panoramas (Photoshop plugin) and Domemaster Photoshop Actions Pack.

Editing the top, bottom, or sides of an equirectangular projection (like removing a tripod)

Editing equirectangular projections near any image border is difficult. The top and bottom of an equirectangular image is very distorted, and the image actually wraps across the right and left border. Let’s use one of the most common editing desires as an example: tripod removal. At the very bottom of this 360 photo taken at Facebook’s Hacker Square is a tripod:

If this were a normal image, it would be easy to remove the tripod. But here’s what the picture looks like when opened using a traditional image editor. The tripod is now warped across the entire bottom of the image, and is nearly impossible to edit.

The tripod is warped across the entire bottom of the image!

To edit, you’ll want to get the subject(s) you want to change away from areas of the image that are excessively warped. One solution is to rotate the 360 photo so that the tripod is no longer at the bottom. Using a tool like Flexify 2 makes this easy. Rotating latitudinally by -90 degrees puts the tripod in the vertical middle of the image. In the middle of the image, it’s easy to remove the tripod using traditional tools like the Healing Brush.

Once you’re happy with your edits, load Flexify 2 again and do a +90 latitudinal rotation to get the image back to normal orientation. Export as a jpg, inject the appropriate metadata, and you’re ready to share to Facebook.If you want to edit across the right / left seam, you can rotate your image longitudinally to get access to that seam, again, in the middle of your newly-transformed image. Here’s a 180-degree longitudinal rotation of the same image:

You’ll notice that the picture’s orientation has been rotated exactly half way; the building with the Facebook display is now “behind” us. This, incidentally, is also a way to force the initial viewing orientation.

Setting the default view

By default, Facebook sets the initial view to be the middle of the equirectangular projection. If you want the first view of a 360 photo to be something specific, transform your picture until your desired view is right in the middle. You can use Flexify 2 to do this, or you can use the “Offset” filter in Photoshop (Filters > Other > Offset). Choose the “Wrap around” setting in the “Undefined Areas” box, and specify the number of pixels you’d like to shift the image. Thanks to Gianluca Colombi for the Offset filter tip!

Use Photoshop’s “Offset” filter to shift your 360 photo around

Changing projections for editing

Other projection types like cubemaps might be more suitable for conventional image editing. There are various tools out there that can convert from equirectangular to cubemap, but very few can convert from cubemaps back to equirectangular. One such tool is vrProjector, which can be used to convert back and forth between the two.

A cubemap converted by vrProjector could be used for editing 360 photos

Final notes on editing in 360

In general, you can use tools designed for panorama manipulation to transform equirectangular projections into other projections that might be more edit-friendly. When you do this, be aware that such transformation have the potential to be destructive to data, and you could be degrading the final quality of your 360 photo. Use care when doing such transforms!