Refactor: extract PageCount and ImageExtractor