added length limitation on jpeg image tree creation