add image compressor
fix index for input buffer