public boolean equals(Object otherO) {
    if (otherO == null) {
      return false;
    }
    if (!(otherO instanceof Picture)) {
      return false;
    }

    Picture other = (Picture) otherO;

    if (image == null || other.image == null) {
      return image == other.image;
    }
    if (image.getWidth() != other.image.getWidth()
        || image.getHeight() != other.image.getHeight()) {
      return false;
    }

    for (int i = 0; i < image.getWidth(); i++) {
      for (int j = 0; j < image.getHeight(); j++) {
        if (image.getRGB(i, j) != other.image.getRGB(i, j)) {
          return false;
        }

      }
    }
    return true;
  }