The core of the algorithm relies on the Polar Coordinates distortion filter in Photoshop. This filter will remap a rectangular image to a circular image. Imagine wrapping a sheet of paper around a cone and then viewing the cone from the top. Parts of the paper must shrink or stretch so that the ends will meet. In addition the left and right sides of the image must be similar so there will be no seam when joined together.
A 360° panorama works well for this purpose since the ends join together nicely. Another way to make the ends meet is to mirror the image. In this action the image is mirrored, using a Magic Mirrors action, prior to invoking the Polar Coordinates filter.
In order for the results to be a circle the original image must be square. It's okay to do a bit of squishing to make this happen as things will be squished even more by the Polar Coordinates filter. To do this in Photoshop choose Image > Image Size and disable Constrain Proportions (prior to CS6) or click on the link between Width and Height (CS6 or later) and specify the same pixel count for both dimensions.
When running the action you will be prompted to enable one of the following Magic Mirror actions:
- 2 Mirror L: mirror the left side
- 2 Mirror R: mirror the right side
- 4 Mirror TL: mirror the top left quadrant to the remaining quadrants
- 4 Mirror TR: mirror the top right quadrant to the remaining quadrants
- 4 Mirror BL: mirror the bottom left quadrant to the remaining quadrants
- 4 Mirror BR: mirror the bottom right quadrant to the remaining quadrants
Other Magic Mirror actions, that mirror the top or bottom, won't do the job because they don't ensure the left and right sides match. After creating the magic sphere the action pauses so you can select and isolate the sphere.
Original and several mirrors. The original has been resized to a squre. The image can be rotated in the action.