Q:

How can I print pixel size without RGB?

I am trying to print size of the pixel not the RGB and sum of the pixel. But somehow it is showing both pixel and RGB. Is there anyway just to display pixel and the sum of the pixel in the command window?
close all;
clc;
clear all;
A = imread('Europe.jpg');
imshow(A);
size(A)
sum(A(:))

A:

SizeA = size(A);
fprintf('The amount of pixels in the horizontal and vertical directions are %d and %d respectively \n',SizeA(1),SizeA(2));
fprintf('The total number of pixels is %d',SizeA(1)*SizeA(2))

You can use an output variable for size to get all sizes as a vector, and then use fprintf to format string for command line output.

