some useful function for image process