MCPcopy Create free account
hub / github.com/32comic/image2pixel-web / detectPixelBlockSize

Method detectPixelBlockSize

pixelizer.js:269–285  ·  view source on GitHub ↗

* 检测像素块大小

(imageData)

Source from the content-addressed store, hash-verified

267 * 检测像素块大小
268 */
269 detectPixelBlockSize(imageData) {
270 const { data, width, height } = imageData;
271
272 // 1. 水平扫描线分析
273 const horizontalSizes = this.analyzeHorizontalScanlines(data, width, height);
274
275 // 2. 垂直扫描线分析
276 const verticalSizes = this.analyzeVerticalScanlines(data, width, height);
277
278 // 3. 综合分析
279 const candidates = this.findCommonSizes(horizontalSizes, verticalSizes);
280
281 // 4. 验证候选大小
282 const bestCandidate = this.validateCandidates(imageData, candidates);
283
284 return bestCandidate;
285 }
286
287 analyzeHorizontalScanlines(data, width, height) {
288 const sizes = [];

Callers 2

autoDetectAndSuggestMethod · 0.95
processAutoModeMethod · 0.95

Calls 4

findCommonSizesMethod · 0.95
validateCandidatesMethod · 0.95

Tested by

no test coverage detected