-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_tiff.mjs
More file actions
27 lines (24 loc) · 912 Bytes
/
check_tiff.mjs
File metadata and controls
27 lines (24 loc) · 912 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { fromFile } from 'geotiff';
async function check(path) {
console.log(`Checking ${path}...`);
try {
const tiff = await fromFile(path);
const image = await tiff.getImage();
const width = image.getWidth();
const height = image.getHeight();
const tileWidth = image.getTileWidth();
const tileHeight = image.getTileHeight();
const samplesPerPixel = image.getSamplesPerPixel();
console.log(` Dimensions: ${width}x${height}`);
console.log(` Tiled: ${Boolean(tileWidth)}`);
if (tileWidth) {
console.log(` Tile Size: ${tileWidth}x${tileHeight}`);
} else {
console.log(` Strip Size: ${image.getFileDirectory().RowsPerStrip}`);
}
} catch (e) {
console.error(` Error: ${e.message}`);
}
}
await check('public/identity_cog.tif');
await check('public/mpack_poc.tif');