def METHOD_NAME(self, f):
    # Upload pixel size checking can be disabled by setting max upload pixel to None
    if self.max_image_pixels is None:
        return
    # Check the pixel size
    width, height = f.image.get_size()
    frames = f.image.get_frame_count()
    num_pixels = width * height * frames
    if num_pixels > self.max_image_pixels:
        raise ValidationError(
            self.error_messages["file_too_many_pixels"]
            % {"num_pixels": num_pixels, "max_pixels_count": self.max_image_pixels},
            code="file_too_many_pixels",
        )