Handle images with trailing NULs.

Some (valid) JPG images containing trailing NUL bytes, which
were not handled.

A fast check is done to determine if the EOI marker is at the
end of the file, and if that fails the slow check is done to
search for the EOI marker.