I was surprised (but also pleased!) that other people were interested in my other blog article about Microsoft’s .pano file format, and in hindsight I was a little miserly keeping all the real code and knowledge to myself.
If you just want my version, skip to the end of this post.
Since I wrote that blog there’s now an ‘official’ way to get .pano files of arbitrary panoramas:
- Get yourself a Microsoft account, since you’ll need it for the next step.
- Upload the flat panorama to http://photosynth.net via the Microsoft Research panorama software Image Composite Editor if you want to assemble it from the original photos, or the Photoshop plugin if you don’t have the originals or don’t want to spend time recreating it. (You can also create and upload directly from Windows Phones and iPhones, but the resolution of their panoramas is limited to about 5 MB, which misses the point of doing this.)
- View your newly uploaded panorama and find the ‘Export’ button, alongside the Edit button underneath the displayed panorama. Wait several minutes.
- Get an email alerting you, or just keep refreshing until the button changes to ‘Download’.
- Download and enjoy your valid and totally functional .pano file!
Pros: No worries about incompatibility with Microsoft’s software for viewing .panos; extra potentially-useful metadata such as geotag or initial viewing direction; ‘perfect’ appearance.
Cons: Requires Microsoft account; requires sharing the image with a remote computer (albeit you can keep the panorama private and delete it later); delay from uploading and downloading the potentially large pano, and waiting for the exported file to be created.
If you’d rather do things the hard way, I’ve improved on my previous version of ‘PanoConverter’. Here’s how you use it:
- From an existing or new panorama, create cube faces – i.e. convert it to up to 6 equirectangular projections with a field of view 90×90 degrees. This is fairly straightforward with Hugin/Panotools (for example) or plenty of others. Don’t bother creating faces with no content.
- The resolution of the file isn’t too important, but I expect it needs to be exactly square (same height and width). Images that Windows can display should work – JPEGs are fine, but so are PNGs and TIFFs among others.
- Open PanoConverter.
- Step 1: Load the images you created, one by one in the correct order (it’s listed as you go). If you don’t have a file for that side of the cube – for instance, if the original was too narrow to reach the top or bottom – then just click Cancel. Once you’ve gone through all six, they’ll be displayed (with empty sides covered in black) to make sure you’ve got them in the right places.
- Step 1.5: Adjust the quality of the eventual pano, if you want a particularly small file or good quality output. Despite the position of this, there’s no live preview or anything like that.
- Step 2: Save the panorama! Choose a folder – preferably empty – to put the created files in. Then wait several minutes depending on panorama resolution and computer performance. When the program is done, it’ll pop up a message box saying ‘Finished!’, but it doesn’t update at all during the work and won’t respond. If it actually crashes, you’ll get a separate error message.
- Step 2.5: If it didn’t explicitly crash in Step 2, you may as well close it anyway, because the buttons are disabled to avoid running into potential memory leaks or bugs I still didn’t find.
- Step 3: Assuming Step 2 was successful, find your folder – containing a subfolder called ‘formats’ and a file called [Content_Types].xml – and compress these two items into a zip folder. Make sure you do it correctly – if you try to zip the folder above that contains them, it won’t work. I haven’t experimented with settings here but both no compression and at-least-some compression work.
- Step 3.5: Rename your zip file so it has the extension .pano.
- Enjoy your new .pano file!
Pros: Image doesn’t have to leave your computer; time taken not dependent on speed of internet connection.
Cons: The file created is the bare minimum that the Photos app understands, with no additional metadata; probably inferior appearance to correctly-created files; possibly inferior performance due to factors I’m not even aware of but that Microsoft employees took care to avoid; has a lower maximum resolution.
If you still want PanoConverter – I didn’t spend much time on naming – there are two options. You can download it here (the zip file is only 8KB), or you can get the code here and make or fix it yourself. For the time being the code is licensed under the MIT License. I think.
Some other tips:
- Does the PanoConverter output .pano look a bit weird – particularly with thin black lines between cube edges at some zoom levels, or slightly overlapping cube sides? Sorry. Various values that the pano needs don’t quite match up to the original file measurements, and I don’t know their relationship. I got it fairly close through trial and error, but the ‘official’ versions still look nicer.
- Is the program crashing when you do something? The easy solution is to not do that thing, since it contains almost no error-checking (e.g. is the picture you loaded actually a picture? The program doesn’t test).
- Is the program crashing with out of memory exceptions? Sorry. That might be my fault, since I wouldn’t be surprised if there are still memory leaks somewhere (not to the point of endangering a system, since it solves the problem by crashing first). As a guess, it’s not very efficient anyway, so it might happen on computers without much RAM or on very large panoramas – I had no problems with four cube faces of resolution 7832×7832, so it’s somewhere above that. If it crashes before you can load all the cube faces, it would have crashed while making the panorama anyway.
- There is one exception if you’re determined to use it and have memory problems – if you just load one face and Cancel the others, and do this repeatedly to the same location with a different face each time, you should end up with a mostly useable file. (At worst, you’ll see a bit more flickering on movement because the low-resolution ‘atlas’ is missing most of its sides.)