Thanks, but not work very well.
I use C.
Here is the code I generate data.
FILE *f_out = fopen("LL.dat", "wb");
fwrite(LL, sizeof(short int), 256*256, f_out);
fclose(f_out);
Then I try Matlab.
f = fopen('LL.dat', 'rb');
d = fread(f, [256,256], 'int16');
imwrite(d, 'LL.jpg', 'jpg', 'BitDepth', 16, 'Mode', 'lossless');
imwrite(d, 'LL.png', 'png', 'BitDepth', 16);
The image is not right. BTW, data LL is correct.
I verify using other ways.
Thank you for the help.