PNGMetadata (PNG info)
ts
function PNGMetadata(imgFile: string): object;Extracts basic meta-information about a PNG image file, such as its width, height, and validity.
Parameters
| Name | Type | Description |
|---|---|---|
| imgFile | string | Path to the PNG image file to be analyzed. |
Returns
A JSON object containing metadata fields such as Height, Width, and Valid. If extraction fails or the file is not a valid PNG, an empty object is returned.
NOTE
PNG files typically do not contain EXIF metadata. Only basic image properties are available.
Example
ts
var mdata = PNGMetadata('./self_portrait.png');
Log(JSON.stringify(mdata, null, 2));Example output:
json
{
"Valid": true,
"Height": 360,
"Width": 480
}