How to detect white background
Interesting problem! I took a stab at this, see if this works for your use case.
It relies on ImageMagick to check for the top left pixel color (0,0) after the image is uploaded (but will also work if you hit resave). (If you want to check the other 3 corners, you'll need more code but this should get you started.)
To use it, you'll need a lightswitch field called hasWhiteBackground on your asset volume (or change the name in the script).
The light switch gets switched to true if the top right corner of the image is white or transparent.
The &quot;magic&quot; is in the getImagePixelColor function.
Event::on(
    \craft\elements\Asset::class,
    \craft\elements\Asset::EVENT_BEFORE_SAVE,
    function(\craft\events\ModelEvent $event) {
            $asset = $event-&gt;sender;
            
            
    if ($asset-&gt;kind == 'image' ) {
        
        if  ($event-&gt;isNew) {
            
            $assetFilePath = $asset-&gt;tempFilePath;
        
        } else {
            
            $volumePath = $asset-&gt;getVolume()-&gt;settings['path'];
            $folderPath = '/' . $asset-&gt;getFolder()-&gt;path;
            $assetFilePath = Craft::getAlias($volumePath) . $folderPath . $asset-&gt;filename;
        
        }
        
    
        $img = new \Imagick($assetFilePath);
        $pixel = $img-&gt;getImagePixelColor(1, 1);
        $p = $pixel-&gt;getColor();
        
        
        if (($p['r'] == 255 &amp;&amp; $p['g'] == 255 &amp;&amp; $p['b'] == 255) || ($p['r'] == 0  &amp;&amp; $p['g'] == 0 &amp;&amp; $p['b'] == 0 &amp;&amp; $p['a'] == 0)) {
            $asset-&gt;setFieldValue('hasWhiteBackground','1');
        
        }
    }


                
});