An image is often represented as a MxNx3 matrix, where each element of a matrix is a uint8 value ranging from 0 to 255 (this is 1 byte of data. 1 byte = 8 bits = value from 0 to 255).
Thus, each pixel of an image is of size 1x1x3 matrix for the Red, Green, and Blue values. With that said, that code line 5 is incorrect if dealing with color images, as each pixel actually requires 3 bytes of data (Ex. White = [255, 255, 255] = 3 bytes)
image size should be:
If you have the liberty of editing the code, change the variable names to be more descriptive.
ImageSizeKB = prod(b) / 1024;
Another way to get image size is by using iminfo FileSize
ImageInfo = iminfo(abc);
ImageSizeKB = ImageInfo.FileSize / 1024;