namespace AIStudio.Assistants.BeyondFactsLab; /// /// The copy of an image which the lab keeps as material. /// /// /// The copy is prepared for models when the person adds the image: turned upright, at most 2,560 pixels along each /// edge, as JPEG or PNG, and without metadata such as the place where a photo was taken. It lies beside the record /// of the material as materials/ID.EXTENSION. /// public sealed class BflMaterialImage { /// /// The file extensions a copy may have; the runtime tells the format of an image by its extension. /// public static readonly IReadOnlySet EXTENSIONS = new HashSet(StringComparer.Ordinal) { "jpg", "png" }; /// /// Gets or sets the file extension of the copy, without the dot, e.g., "jpg". /// public string Extension { get; set; } = string.Empty; /// /// Gets or sets the width of the copy in pixels. /// public int Width { get; set; } /// /// Gets or sets the height of the copy in pixels. /// public int Height { get; set; } /// /// Checks whether the description of a copy is complete: a known extension and a size. /// /// The description, or null. /// True when the description is complete; false for null. public static bool IsValid(BflMaterialImage? image) => image is { Width: > 0, Height: > 0 } && EXTENSIONS.Contains(image.Extension); }