measure. Creating an object based on existing graphics file

^image::measure[file]
^image::measure[file_name]
^image::measure[file;options] [3.4.6]
^image::measure[
file_name;options] 
[3.4.6]

Creates an object of class
image, measuring dimensions of an existing graphics file or an object of class file in supported format. Parser supports GIF, JPEG and PNG, and starting from version [3.4.6] additionally supports TIFF, BMP, WEBP and with $.video(true) option supports MP4 (MOV) video.

The picture itself is not used-the constructor only keeps in memory the dimensions and the name of the file. The main purpose of the method is to determine dimensions and, for example, the subsequent method
html call for the created object.

Parameters:
file-object of class file
filename-filename with path

Options hash can be specified:


Default
Description
$.video(false/true)
false
To measure the dimensions of MP4 (MOV) video files.
$.exif(false/true)
false
To read the EXIF information (http://www.exif.org) stored in JPEG files. Before version [3.4.6] EXIF information was read always.
$.xmp(false/true)
false
To read the XMP information (https://en.wikipedia.org/wiki/Extensible_Metadata_Platform) stored in JPEG files.
$.xmp-charset[charset]
UTF-8
The charset of XMP information.



$ .video (false / true) - additional size of video files in MP4 format (MOV). By default, no preset.
$ .exif (false / true) - additionally read EXIF information () from JPEG files. By default, not read (up to version 3.4.6 EXIF information was read all the time).
$ .xmp (false / true) - additionally read XMP information () from JPEG files. Do not read by default.
$ .xmp-charset [coding] - coding XMP information. By default UTF-8.

Note: supports EXIF 1.0 and reads tags IFD0 and SubIFD, if any.

Example of creating tag IMG with width and height attributes
$photo[^image::measure[myphoto.png]]
^photo
.html[]

will create object photo of class image, based on existing graphics in PNG format. Tag IMG will be created with reference to the file and width and height specified.

Example of working with EXIF information
$image[^image::measure[jpg/DSC00003.JPG; $.exif(true) ]]
$exif[$image.exif]
^if
($exif){
    Camera manufacturer, model$exif.Make $exif.Model<br />
    Shooting time^exif.DateTimeOriginal.sql-string[]<br />
    Exposure time$exif.ExposureTime seconds<br />
    Aperture: F$exif.FNumber<br />
    Flash used^if(def $exif.Flash){^if($exif.Flash){yes;no};not known}<br />
}{
    No EXIF information<br />
}



Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 25.01.2021