A panoramic 360 image is a very wide image format that can be used to display a 360 degree view as seen from a single point. Some 360 panoramic images are created by special 360 cameras that can take a single image of the entire panorama, while others can be created by stitching together a series of images that overlap each other into a single image. These images may be used in different verticals such as showing off real estate, for showing the inside and outside of a property, and travel, for showing panoramic views of tourist destinations, cities, islands, mountain views, etc.
360 spin sets, on the other hand, are normally used to showcase individual products as seen from different viewpoints, allowing the user to rotate the object in question about a central axis.
But another use for the 360 spin set is for displaying 360 panoramic images that can also be rotated by a user, giving the effect to the user of turning in place while seeing the 360 view.
The Cloudinary Product Gallery has built-in support for displaying spin sets by automatically fetching all images with a particular tag and combining them into a single spin set, where each image is included as a single frame of the resulting 360 spin set. This makes it super easy to automate the process of creating spin sets with Cloudinary transformations.
The following script takes a panoramic 360 image and generates a 360 spin set that can be easily viewed using Cloudinary’s Product Gallery. The script creates and then uploads all the individual images that will be needed to display it as a single spin set. The script is written in Java, but uses very simple code and can be easily adapted to work with any of the Cloudinary SDKs.
The script uses the
public_id of an uploaded panoramic 360 image. It generates all the images needed and uploads them to your Cloudinary account. Every sequential image is identified with a combination of the
public_id and a sequential number, so that the order of the images will be preserved when displaying them in the Product Gallery. All the assets are also given the same
tag when uploaded to enable the Product Gallery to fetch them all to display as a spin set.
The script needs to be updated with the correct
public_id of your uploaded panoramic 360 image, but it can also be customized by selecting new values for the
The width of the generated 360 spin set images is defined by the
width parameter in the script, and is given as a real number relative to the original panoramic image. So to create a spin set where the individual images are 40% of the width of the original uploaded 360 panoramic image, set the width parameter to
The following gallery shows examples of 3 different spin sets created from the same panoramic image, the first with a width of 30% of the original, then 50% and lastly with 80%.
frames parameter in the script determines the number of individual images to be created by the script for the generated spin set. Selecting a higher number of frames will result in smaller changes between the individual images and a smoother scrolling experience when rotating the spin set.
The following gallery shows examples of 3 different spin sets created from the same panoramic image, the first with 20 frames, then 50 frames, and lastly with 90 frames:
Of course, the more images that are generated, the larger the bandwidth required to deliver all the images to the end user.
Another consideration is that the Product Gallery widget is also fully responsive to the available width, and requests images from Cloudinary that fit the width needed. This saves bandwidth by only delivering scaled down images depending on the user’s view port (browser or mobile device). This may result in a large number of generated image files when displaying the spin sets in multiple view ports. So, if you want to limit the number of generated images, you can add the
imageBreakpoint parameter to the code for displaying the Product Gallery, and select a larger value than every 100 pixels (the default).
All the Product Gallery needs in order to display spin sets is the
tag that they all have in common. The Product Gallery then fetches all images with a that tag and combines them into a single entity, where each image is included as a single frame of the resulting 360 spin set, and sorted alphanumerically by their Public ID, which is why the script adds in the frame number to the public_id of the individual frames. The following code will render the Product Gallery and display the spin set of all images tagged with “room360”:
See the Product Gallery documentation for more information on the Product Gallery and all the ways the gallery can be customized.
Displaying panoramic 360 images as interactive spin sets is a novel and engaging experience for your users. The beauty of 360 panoramic images is they can be broken up in a way that seamlessly joins the beginning of the image to the end, allowing the user to experience continuously turning in place. All widget, image transformation and delivery features discussed here are available with no extra charge for all Cloudinary’s plans, including the free plan.