FIX: now works for all image types