Save new image as tif
13 views (last 30 days)
Show older comments
Angela
on 2 Apr 2019
Answered: Dhanashree Mohite
on 9 Apr 2019
I have several images(uint16) that I want to save as pairs side by side but the sizes of the images when I save them are not consistent. The images when i read them are *jpg and each has size of 7.7MB.
When I plot them and try to save the first pair
images=[im1,im2]
figure(1),imshow(images)
print(gcf,'-dtiffn','example.tiff')
the image that comes out is 11 MB, when I expected about 16 MB. Additionally I have tried to save the outcome differently
imwrite(im2uint16(images),'outfile.tif')
but the outfile.tif is 961MB which is also unexpected comparing to the initial size of the images. I want to be able to save pairs of images side by side without compression but none of the ways I have tried seems right.
0 Comments
Accepted Answer
Dhanashree Mohite
on 9 Apr 2019
As per my understanding size of the image will depend on compression technique that we are using and also as header size will differs as per the technique.
Also, image = [im im] won’t be exact double of the size, as only no. of columns are doubled and rows are as it is.
For Eg.
I have one .jpg image say, im1 of size 84KB. When I read image using ‘imread’ it will be of 576x1024x3 uint8 (1.7MB approx.). After, im2 = [im1 im1], its size will be 576x2048x3 uint8 (3.53MB approx.).
After ‘imshow’ and saving image using saveAs, size of saved image will be different as per the format used. For .jpg it will be 65KB, .tif with compression it will be 1.46MB and .tif without compression it will be 2.15MB.
Also, if you write the image using ‘imwrite(im2,'outfile.tif')’ size will be more proper 3.34MB approx.. as it will store file exactly 576x2048x3 uint8.
0 Comments
More Answers (0)
See Also
Categories
Find more on Import, Export, and Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!