1
- using IS4 . SFI . MediaAnalysis . Images ;
2
- using IS4 . SFI . Services ;
1
+ using IS4 . SFI . Services ;
3
2
using IS4 . SFI . Tags ;
4
3
using IS4 . SFI . Tools ;
5
4
using IS4 . SFI . Vocabulary ;
6
5
using System ;
7
6
using System . Collections . Generic ;
8
7
using System . ComponentModel ;
9
8
using System . Drawing ;
10
- using System . Drawing . Imaging ;
11
9
using System . IO ;
12
10
using System . Linq ;
13
11
using System . Threading . Tasks ;
@@ -26,7 +24,7 @@ public class ImageAnalyzer : MediaObjectAnalyzer<IImage>
26
24
/// </summary>
27
25
[ ComponentCollection ( "image-hash" ) ]
28
26
[ Description ( "A collection of image-based hash algorithms that produce hashes from the low-detail form of the image." ) ]
29
- public ICollection < IObjectHashAlgorithm < IImage > > LowFrequencyImageHashAlgorithms { get ; } = new List < IObjectHashAlgorithm < Image > > ( ) ;
27
+ public ICollection < IObjectHashAlgorithm < IImage > > LowFrequencyImageHashAlgorithms { get ; } = new List < IObjectHashAlgorithm < IImage > > ( ) ;
30
28
31
29
/// <summary>
32
30
/// A collection of byte-based hash algorithms producing hashes
@@ -97,10 +95,10 @@ public async override ValueTask<AnalysisResult> Analyze(IImage image, AnalysisCo
97
95
node . Set ( Properties . Height , image . Height ) ;
98
96
node . Set ( Properties . HorizontalResolution , ( decimal ) image . HorizontalResolution ) ;
99
97
node . Set ( Properties . VerticalResolution , ( decimal ) image . VerticalResolution ) ;
100
- int paletteSize = image . Palette . Count ;
98
+ var paletteSize = image . PaletteSize ;
101
99
int bpp = image . BitDepth ;
102
- if ( bpp != 0 ) node . Set ( paletteSize > 0 ? Properties . BitDepth : Properties . ColorDepth , bpp ) ;
103
- if ( paletteSize > 0 ) node . Set ( Properties . PaletteSize , paletteSize ) ;
100
+ if ( bpp != 0 ) node . Set ( paletteSize == 0 ? Properties . ColorDepth : Properties . BitDepth , bpp ) ;
101
+ if ( paletteSize is int size && size > 0 ) node . Set ( Properties . PaletteSize , size ) ;
104
102
}
105
103
106
104
if ( ! storedAsData )
0 commit comments