Problem saving an image as jpg

조회 수: 4 (최근 30일)
Angela
Angela 2019년 4월 16일
댓글: Walter Roberson 2019년 4월 16일
I am running a procedure in several images and I am trying to save a smaller jpg image (along with a lossless tif image) for quick inspection to make sure the program runs ok. So far I never had troubles and the program has run successfully for 200 images and saved the equivalent results.
Today one of the images failed to save and gave me this error message
''Error using wjpg12c
JPEG library error (12 bit), "DCT coefficient out of range".
Error in writejpg (line 127)
wjpg12c(data,filename,props);
Error in imwrite (line 485)
feval(fmt_s.write,data,map,filename,paramPairs{:});''
The same image was previously saved as a tif with no problems. The command i used to save the image as jpg is
imwrite(im2uint16(NewImage),outfile,'BitDepth',12,'Mode','lossy')
Has anyone encountered this error before? I am using Matlab 2018a.
  댓글 수: 2
Image Analyst
Image Analyst 2019년 4월 16일
Attach your image variable in a .mat file so we can try it.
Walter Roberson
Walter Roberson 2019년 4월 16일
Hunting through my memory I seem to recall that coefficients out of range is possible but expected to be very rare. Unfortunately I never figured out the circumstances under which it could happen... high contrast in just the wrong pattern or something like that.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

태그

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by