# Input image size in MATLAB

Hi I am trying to get the image size of the uploaded image in MATLAB. So far I have got :

read=imread(image.png)



However this gives me an error. The image size is 300px by 256px, and I want my ymax and xmax to automatically get the pixel values. How do I do this?

It's not a MATLAB'ish way of doing that, try:

[xmax, ymax, nchan] = size(read);


Where nchan is the number of channels. Also it can be done by:

xmax = size(read, 1);

[xmax, ymax, ~] = size(read);