I have to transform and remap an equirectangular image to an other equirectangular image with a 90° roll. I did it with Pano2VR. The problem is that I have to do it programmatically from the server side. So I can't use a G.U.I. to do it. First, I oriented my research to imagemagick. I tried the Fred ImageMagick scripts but could not find anyone to do what I want to do. Moreover, the processing time of an image appears very long compared to Pano2VR. I directed my investigations to OpenCV and the libgnomonic. It's presently the most interesting way. This library allows the user to transform projections (equirectangular to rectilinear and vice versa) or make equirectangular mapping transformation. I played with Norama-suite which contains some scripts to deal with the library. For example, I would to convert an rectilinear image to an equirectangular but the output was just a black background image (why? I didn't find the answer). However, this second link could resolve my problem. I have this image: and I want to transform it to this image Well, I'm not comfortable at all with C. I think I should use these two files: https://www.github.com/FoxelSA/libgnomonic/blob/master/src/gnomonic-transform.h https://www.github.com/FoxelSA/libgnomonic/blob/master/src/gnomonic-transform.c But I don't know how. And above all, I want to understand. Am I on the right way? What transformation is applied on the first image? Is there a way to do it with python or a bash script? Well, thank you for your help. **EDIT Transposition of C in python ** The following code didn't work and return and IndexError. However I tried to catch and pass the exception and the first right part of the image did not seem changed. import math from PIL import Image img = Image.open("img1.jpg") img = img.convert('RGB') pixel = img.load() width, height = img.size img2 = img.copy() for y in xrange(height): for x in xrange(width): xx = 2*(y+0.5) / width - 1.0 yy = 2*(y+0.5)/ height - 1.0 lng = math.pi * xx lat = 0.5 * math.pi * yy # NOTE! These axes are transposed because that's what the question is about Z = math.cos(lat) * math.cos(lng) # normally X Y = math.cos(lat) * math.sin(lng) # normally Y X = -math.sin(lat) # normally -Z D = math.sqrt(X*X+Y*Y) lat = math.atan2(Z, D) # ? normally lat = math.asin(Z) lng = math.atan2(Y, X) #ix and iy must be integers ix = int((0.5 * lng / math.pi + 0.5) * width - 0.5) iy = int((lat/math.pi + 0.5) * height - 0.5) #not sure of this part to remap the image newpixel = pixel[ix, iy] img2.putpixel([(x+width/4) % width, y], newpixel) #I tries as mentioned in the following code to invert x and y in the two previous lines but the index error out of range comes back img2.show() Continue reading...