working on function from cimage to jimage