ScanBlob (open)

Scan a blob and explain its contents.

Syntax

LOADLIB "wh::files.whlib";

RECORD FUNCTION ScanBlob(BLOB toscan, STRING filename, RECORD options)

Parameters

BLOB toscan

Blob to scan

STRING filename

Filename associated with the blob, if known. This may help detection of some file formats

RECORD options

Options

BOOLEAN extractdominantcolor

If TRUE, extract the dominant color from images

BOOLEAN generatehash

If TRUE, calculate the hash of the data

STRING mimetype

Force the mimetype to the requested type

Return value

RECORD

A record describing the scanned blob

STRING dominantcolor

Image's dominant color as a #RRGGBB code, 'transparent' if the image is transparent. Only extracted if the extractdominantcolor option is enabled

STRING extension

The proper or usual extension for the file's mimetype, if known to webhare. Either empty or a text starting with a dot ('.')

STRING hash

UFS encoded SHA-256 hash of the file. Only calculated if the generatehash option is enabled

INTEGER heigh

Image height (in pixels)

STRING mimetype

The mimetype for the file. If unrecognized, application/octet-stream

BOOLEAN mirrored

True if this is a mirrored image

RECORD refpoint

Reference point if set, default record otherwise

INTEGER refpoint.x

X coordinate of reference point (in pixels)

INTEGER refpoint.y

Y coordinate of reference point (in pixels)

INTEGER rotation

Image rotation in degrees (0,90,180 or 270)

INTEGER width

Image width (in pixels)