From: Nelson on
Trying to modify a JPG file captured by my digital camera, original
file size is about 2MB.

A = imread('pic1.jpg', 'JPG'); %3D matrix, each element is a uint8.
imwrite(A, 'picout.jpg'); %picout.jpg < 1 MB.

Where data lost? Thanks
From: roger on
On Nov 3, 9:43 am, Nelson <linsna...(a)yahoo.com> wrote:
> Trying to modify a JPG file captured by my digital camera, original
> file size is about 2MB.
>
> A = imread('pic1.jpg', 'JPG'); %3D matrix, each element is a uint8.
> imwrite(A, 'picout.jpg'); %picout.jpg < 1 MB.
>
> Where data lost? Thanks

when you read the file, you end up with a bitmap in the matrix A that
matlab has decompressed from the compressed jpg file format. When you
write it back to a jpg file, matlab compressess that matrix again
according to some jpeg standards. I think that the level/method of
compression may differ.
From: Ashish Uthama on
On Tue, 03 Nov 2009 03:43:10 -0500, Nelson <linsnail2(a)yahoo.com> wrote:

> Trying to modify a JPG file captured by my digital camera, original
> file size is about 2MB.
>
> A = imread('pic1.jpg', 'JPG'); %3D matrix, each element is a uint8.
> imwrite(A, 'picout.jpg'); %picout.jpg < 1 MB.
>
> Where data lost? Thanks

My guess would be that the Camera compression probably uses a faster,
lower compression ratio implementation.

JPG also has a 'quality factor' which affects the file size (see help
imwrite). You could use IMFINFO to see if there is any difference in the
coding method/ process.
From: Nelson on
> My guess would be that the Camera compression probably uses a faster,  
> lower compression ratio implementation.
>
> JPG also has a 'quality factor' which affects the file size (see help  
> imwrite). You could use IMFINFO to see if there is any difference in the  
> coding method/ process.

Thanks, it works with the Quality factor.