Skip to content

Commit e65a535

Browse files
committed
测试限制面积的算法
1 parent f17f173 commit e65a535

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • src/MediaConverters/MediaConverters.Tool

src/MediaConverters/MediaConverters.Tool/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,20 @@
1212

1313
ImageDecoder d = WebpDecoder.Instance;
1414

15+
var maxPixelCount = 100_00_00;
16+
17+
var w = 1500;
18+
var h = 1300;
19+
20+
var s = w / (double) h;
21+
22+
var pw = (int) Math.Sqrt(maxPixelCount * w / (double) h);
23+
var ph = (int) Math.Sqrt(maxPixelCount * h / (double) w);
24+
25+
var s1 = pw / (double) ph;
26+
27+
28+
1529
var tiffFile = @"E:\Download\file_example_TIFF_1MB.tiff";
1630
var file = @"E:\Download\file_example_favicon.ico";
1731
var buffer = File.ReadAllBytes(file);

0 commit comments

Comments
 (0)