I have a single 2.5 GB JP2 image of a city that I need to split into tiles, which I'll then process to create flight simulation scenery.

Google as I might, I can't find the solution.

The JP2 apparently has GIS XML data embedded, which doesn't affect me either way, since I don't need it. All I'm trying to do is break the image down into x-number of preferably 2048 x 2048 tiles.

A utility to do this in either OSX or Win7 would be great.



  • Are you interested in a QGIS or ArcGIS approach?
    – Aaron
    Dec 31, 2012 at 23:20
  • 5
    try gdal2tiles.py
    – mdsumner
    Jan 1, 2013 at 3:33

1 Answer 1


You can write a simple shell script and use gdal_translate utility to chop the tiles. On Mac, get the GDAL build from here. On Windows,the best way to get GDAL is via the OSGeo4W installer. In the following script, you need to replace following things

  • XDIM and YDIM with your source jp2 X and Y dimensions
  • gdal_translate with the actual path on your system
  • input.jp2 with path to your input file.

Save the script in a text file called script.sh. Open a Terminal and run 'bash script.sh'. That will create the tiles in a directory called tiles/ . The script is copied from here with a little modification for your purpose.

mkdir tiles

while [ $YPOS -le $YDIM ]
while [ $XPOS -le $XDIM ]
    echo "$XPOS $YPOS : ${BLOCKNO}.tif"
    gdal_translate -of GTiff -srcwin $XPOS $YPOS $BLOCKSIZE $BLOCKSIZE input.jp2 \
    BLOCKNO=`echo "$BLOCKNO + 1" | bc`
    XPOS=`echo "$XPOS + $BLOCKSIZE" | bc`
YPOS=`echo "$YPOS + $BLOCKSIZE" | bc`
  • 2
    Ah, no problem. Finder wouldn't know about JP2 format so it won't help. You need the GDAL library to read JP2s. If you installed GDAL from the link in my answer, you can use the command 'gdalinfo' to get that information. On my system, GDAL is at /Library/Frameworks/GDAL.framework/Versions/1.9/Programs/gdalinfo . run gdalinfo <path/to/your/jp2> and it will report the dimensions. Similarly add the full path to gdal_translate in the script for it to work. Jan 2, 2013 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.