php-vips will read just the part you need, when it can. It's typically 3x to 5x faster than imagemagick and needs much less memory.
Many image formats do not allow random access. JPEG, PNG, GIF and many others will force you to decompress at least the pixels before the pixels you want which, for huge images of the sort you are handling, will be very slow.
One solution would be to switch to JPEG-compressed tiled TIFF. This format breaks the image into (by default) 256x256 pixel tiles and compresses each one separately. The tiles are stored in a TIFF file with an index, so you can pull out individual tiles very quickly.
For example, you can convert a huge JPEG image to a JPEG-compressed tiled tiff with libvips like this:
$ time vips copy wac_nearside.jpg wac_nearside.tif[tile,compression=jpeg]
real 0m3.891s
user 0m6.332s
sys 0m0.198s
peak RES 40mb
The index makes the image a little larger, but it's not too bad:
$ ls -l wac_nearside.*
-rw-r--r-- 1 john john 74661771 May 7 2015 wac_nearside.jpg
-rw-r--r-- 1 john john 76049323 Feb 24 15:39 wac_nearside.tif
$ vipsheader wac_nearside.jpg wac_nearside.jpg: 24000x24000 uchar, 1 band, b-w, jpegload
You can read out random regions from it in PHP like this:
#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';
use Jcupitt\Vips;
$image = Vips\Image::newFromFile($argv[1]);
$region_width = 100;
$region_height = 100;
for ($i = 0; $i < 100; $i++) {
$left = rand(0, $image->width - $region_width - 1);
$top = rand(0, $image->height - $region_height - 1);
$region = $image->crop($left, $top, $region_width, $region_height);
$region->writeToFile($i . ".jpg");
}
I can run that program like this:
$ time ./crop.php ~/pics/wac_nearside.tif
real 0m0.207s
user 0m0.181s
sys 0m0.042s
peak RES 36mb
So on this elderly laptop it's reading out (and creating) 100 JPEG files in just over 0.2s.