A method for encoding an image comprising: obtaining the image having a first image boundary and a second image boundary opposite to the first image boundary ; determining a location for a division boundary line between the first image boundary and the second image boundary for dividing the image either horizontally or vertically into a first part and a second part, the first part comprising pixels between the first image boundary and the division boundary line and the second part comprising pixels between the division boundary line and the second image boundary ; and providing an indication of the location of the division boundary line ; characterized in that the method further comprises: selecting the location for the division boundary line by examining a depth map of the image to search the location of the division boundary line by examining if a horizontal or vertical line exists for which the depth map indicates similar depth value along the line, and selecting such line as the location of the division boundary line ; and rearranging the image by exchanging order of the first part and the second part to obtain a reconstructed original image, wherein in the reconstructed original image the second image boundary and the first image boundary of the original image are adjacent to each other forming a boundary line between the first part and the second part, and the order of the first part and the second part is opposite to the order of the first part and the second part in the original image . obtaining the image having a first image boundary and a second image boundary opposite to the first image boundary ; determining a location for a division boundary line between the first image boundary and the second image boundary for dividing the image either horizontally or vertically into a first part and a second part, the first part comprising pixels between the first image boundary and the division boundary line and the second part comprising pixels between the division boundary line and the second image boundary ; and providing an indication of the location of the division boundary line ; characterized in that the method further comprises: selecting the location for the division boundary line by examining a depth map of the image to search the location of the division boundary line by examining if a horizontal or vertical line exists for which the depth map indicates similar depth value along the line, and selecting such line as the location of the division boundary line ; and rearranging the image by exchanging order of the first part and the second part to obtain a reconstructed original image, wherein in the reconstructed original image the second image boundary and the first image boundary of the original image are adjacent to each other forming a boundary line between the first part and the second part, and the order of the first part and the second part is opposite to the order of the first part and the second part in the original image . selecting the location for the division boundary line by examining a depth map of the image to search the location of the division boundary line by examining if a horizontal or vertical line exists for which the depth map indicates similar depth value along the line, and selecting such line as the location of the division boundary line ; and rearranging the image by exchanging order of the first part and the second part to obtain a reconstructed original image, wherein in the reconstructed original image the second image boundary and the first image boundary of the original image are adjacent to each other forming a boundary line between the first part and the second part, and the order of the first part and the second part is opposite to the order of the first part and the second part in the original image . <EOS>