problem reading multiple JPEG files

Issue #29 resolved
Former user created an issue

Hi: I ran into a curious problem when reading JPEG files. I have a code that reads hundreds of JPEG files one after the other and it crashes when it reads file # 509.

Here is the code I have:

PRO jpegtest
nf=1000
for ifil=0,nf-1 do begin
  img=bytscl(randomu(s,3,32,32))
  fil='test\test'+strtrim(ifil,2)+'.jpg'
  write_jpeg,fil,img,true=1
  ;print,ifil
endfor
for ifil=0,nf-1 do begin
  fil='test\test'+strtrim(ifil,2)+'.jpg'
  read_jpeg,fil,img
  print,ifil
endfor
stop
end

and the error message:

% Error: READ_JPEG: can not open file: test\test509.jpg % Execution halted at: JPEGTEST 11 C:\fl\fl_0.79.50\lib\jpegtest.pro % $MAIN$

Comments (2)

  1. Lajos Foldy repo owner

    Yes, there is a bug in read_jpeg and the file is not closed. The workaround in issue #30 is fine.

    Fixed for the next snapshot (to be released around end of January). Thanks for the report.

  2. Log in to comment