how to resize an image as per the required dimension

566 views (last 30 days)
ramya s
ramya s on 16 Mar 2011
Edited: KSSV on 15 Mar 2021
i am doing my final yr project on steganography. and my project s suit only for square matrix images. (i.e, 256*256 512*512 1024*1024) like that images. i need images for that. wen i tried to resize other images it does not works.
for eg., I=imread('post.jpg');
[m n] = size(I)
J = imresize(I, [256 256]);
[x y] = size(J)
the output i m getting is m = 324 n = 512
x = 256 y = 1156
i do not know why it is like this. i am not getting any errors. help me what to do what shall i do now? please help me its very urgent
  2 Comments

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 16 Mar 2011
Your image is 3 dimensional (RGB), not 2 dimensional.

More Answers (3)

shyama p
shyama p on 17 Mar 2011
Edited: Walter Roberson on 9 Nov 2017
I1=imread('post.jpg');
I2 = imresize(I1,[256 256]);
In=rgb2gray(I2); % use if the image containing RGB value 3
figure;imshow(In);
imwrite(In,'yi.jpg') ;

dipa teraiya
dipa teraiya on 24 Apr 2018
hello friends i have image of dimension is 84 * 34 and size of image is 16.1 KB Now other image of dimension is same but size of image is different is 16.4 KB so pls tell me which code can be applied when increase the size of image?

salman saleem
salman saleem on 12 Oct 2020
My question is how we can reduce the size of image by taking mean?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!