change only if the size of the image has changed
merge code with openhevc