will return a 1x2 row vector equivalent to this:
Then you get the size of the 1x2 vector img_size using
which will therefore always return the vector [1,2], which is not a scalar, and is thus an invalid input to reshape. Note that the syntax size(X) will always return an 1xN vector, where N>=2.
It is not clear what you are trying to do.