libvips , , . , 100x100 PNG, :
$ time vips crop wtc.png x.jpg 0 0 100 100
real 0m0.063s
user 0m0.041s
sys 0m0.023s
( , , , , wtc.png x.jpg)
100x100 , , :
$ time vips crop wtc.png x.jpg 0 9000 100 100
real 0m3.063s
user 0m2.884s
sys 0m0.181s
JPG strip TIFF , , .
. , tiled TIFF , libvips libtiff :
$ vips copy wtc.png wtc.tif[tile]
$ time vips crop wtc.tif x.jpg 0 0 100 100
real 0m0.033s
user 0m0.013s
sys 0m0.021s
$ time vips crop wtc.tif x.jpg 0 9000 100 100
real 0m0.037s
user 0m0.021s
sys 0m0.017s
OpenSlide, vips, OpenEXR, FITS, PPM/PGM/PBM, HDR, RAW, Analyze, Matlab , , , .
, API , libvips :
http://jcupitt.imtqy.com/libvips/API/current/How-it-opens-files.md.html
crop Python pyvips:
import pyvips
image = pyvips.Image.new_from_file(input_filename, access='sequential')
tile = image.crop(left, top, width, height)
tile.write_to_file(output_filename)
access= - , libvips, , , . , , , TIFF.
. , MIME- stdout:
tile.jpegsave_mime(Q=85)
-, , JPG:
buffer = tile.write_to_buffer('.jpg', Q=85)
Q=85 JPG Q. .