File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Plugins/Flow.Launcher.Plugin.Program/Programs Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -644,21 +644,27 @@ string TryToFindLogo(string uri, string path)
644
644
) ;
645
645
646
646
var selected = logos . FirstOrDefault ( ) ;
647
-
647
+ var closest = selected ;
648
+ int min = int . MaxValue ;
648
649
foreach ( var logo in logos )
649
650
{
650
651
651
652
var imageStream = File . OpenRead ( logo ) ;
652
653
var decoder = BitmapDecoder . Create ( imageStream , BitmapCreateOptions . IgnoreColorProfile , BitmapCacheOption . None ) ;
653
654
var height = decoder . Frames [ 0 ] . PixelHeight ;
654
655
var width = decoder . Frames [ 0 ] . PixelWidth ;
655
- if ( height == 44 && width == 44 )
656
+ int pixelCountDiff = Math . Abs ( height * width - 1936 ) ; // 44*44=1936
657
+ if ( pixelCountDiff < min )
656
658
{
657
- selected = logo ;
658
- break ;
659
+ // try to find the closest to 44x44 logo
660
+ closest = logo ;
661
+ if ( pixelCountDiff == 0 )
662
+ break ; // found 44x44
663
+ min = pixelCountDiff ;
659
664
}
660
665
}
661
666
667
+ selected = closest ;
662
668
if ( ! string . IsNullOrEmpty ( selected ) )
663
669
{
664
670
return selected ;
You can’t perform that action at this time.
0 commit comments