added dual pass image extraction