optimized getForegroundImg