corrected img conversion resolution logic