Added timg_writetiff, tested, is working well.