Sign up ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.



share|improve this question
Are you interested in a QGIS or ArcGIS approach? – Aaron Dec 31 '12 at 23:20
try – mdsumner Jan 1 '13 at 3:33

1 Answer 1

up vote 13 down vote accepted

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 Open a Terminal and run 'bash'. 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`
share|improve this answer
Spatial, many thanks. – Stent Mutton Jan 2 '13 at 4:11
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. – spatialthoughts Jan 2 '13 at 6:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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