code: def pilcoords(self, (x,y)):
          
          
          pilx = int((x - 1 - self.xa) * float(self.upsamplefactor) / float(self.binfactor))
          pily = int((self.yb - y) * float(self.upsamplefactor) / float(self.binfactor))
          
          return (pilx, pily)
docs: Converts the coordinates (x,y) of the original array or FITS file to the current coordinates of the PIL image,
          respecting cropping, rebinning, and upsampling.
          This is only used once the PIL image is available, for drawing.
          Note that we also have to take care about the different origin conventions here !
          For PIL, (0,0) is top left, so the y axis needs to be inverted.