Other Swatches plugins let you choose an attribute (like color) from the available product attributes to change the image gallery, allowing users to preview different options. This is useful when only one attribute physically alters the product, such as color or pattern. Other attributes, like size or CPU speed, which don't affect the product's appearance, don't need this feature.
If implemented, it should be efficient—avoiding unnecessary lookups on every page load. You could hook into the product save action, or something more specific like an image update, and search for the first variation with the desired attribute value (e.g., red). Once found, store a meta value on the product as a list or array that maps the attribute value to the image gallery or specific variation, which is already loaded on the page.