Given an image resource ID returns an image index.
Use this function to retrieve an image index given an image resource ID.