(BETA) Allows storing of additional metadata in JEPG images. More...
Import Statement: | import ArcGIS.AppFramework 1.0 |
Properties
- appMarker : int
- destFilePath : string
- destFileUrl : url
- filePath : string
- fileUrl : url
- signature : string
- version : ushort
Methods
- object keys()
- bool loadValueFromFile(string key, url fileUrl)
- bool loadValueFromFile(string key, string filePath)
- remove(qstringlist keys)
- remove(string key)
- removeAll()
- bool saveValueToFile(string key, url fileUrl)
- bool saveValueToFile(string key, string filePath)
- bool setValue(string key, object value)
- bool setValues(object values)
- object value(string key)
- object values(qstringlist keys)
- object values()
- object values(string key)
Detailed Description
The ImageAttributes component is used for reading and writing medadata in JPEG images stored in custom JPEG APPn markers.
The following code sample sets a number of example metadata values, before printing them in the console log.
ImageAttributes { id: imageAttributes filePath: "~/ArcGIS/Data/Pictures/Esri.jpg" Component.onCompleted: { imageAttributes.setValue("data.json", {"address":"380 New York Street","name":"ESRI"}); imageAttributes.setValue("brownfox.txt", "The quick brown fox jumped over the lazy dog.\n"); imageAttributes.loadValueFromFile("jack.jpg", "~/ArcGIS/Data/Pictures/jack2.jpg"); let _keys = imageAttributes.keys(); console.log("imageAttributes.keys: ", JSON.stringify(_keys)); // ["data.json","brownfox.txt","jack.jpg"] let data = imageAttributes.value("data.json"); console.log("typeof(data): ", typeof data); // object console.log("data: ", JSON.stringify(data)); // {"address":"380 New York Street","name":"ESRI"} let brownfox = imageAttributes.value("brownfox.txt"); console.log("typeof(brownfox): ", typeof brownfox); // string console.log("brownfox: ", JSON.stringify(brownfox)); // "The quick brown fox jumped over the lazy dog.\n" let image = imageAttributes.value("jack.jpg"); console.log(typeof("typeof(image): ", typeof image)); // object console.log("image instanceof ArrayBuffer: ", image instanceof ArrayBuffer); // true console.log("image.byteLength: ", image.byteLength); // 533643 let values = imageAttributes.values(); console.log("imageAttributes.values(): ", JSON.stringify(values)); // {"brownfox.txt":"The quick brown fox jumped over the lazy dog.\n","data.json":{"address":"380 New York Street","name":"ESRI"},"jack.jpg":"blob://imageattributes/jack.jpg"} let notExists = imageAttributes.value("notexist.txt"); console.log("typeof(notExists): ", typeof(notExists)); // undefined console.log("notExists: ", JSON.stringify(notExists)); // undefined let ok = imageAttributes.saveValueToFile("jack.jpg", "~/ArcGIS/Data/Pictures/Jack2.jpg"); console.log("imageAttributes.saveValueToFile: ", JSON.stringify(ok)); // true } }
Property Documentation
Method Documentation
Store a file referred to by URL as a binary object attribute in a JPEG image.
The key parameter
The key of the attribute that will store the file.
The fileUrl parameter
The URL of the file that will be stored as an attribute.
Store a file referred to by filepath as a binary object attribute in a JPEG image.
The key parameter
The key of the attribute that will store the file.
The filePath parameter
The path of the file that will be stored as an attribute.
Remove a list of metadata attributes from the JPEG image.
The keys parameter
A list of attributes to remove from the image.
Remove a single attribute from the JPEG image.
The key parameter
The key of the attribute to remove from the image.
Exports the given attribute to a file at the set URL.
The key parameter
The key of the attribute to export.
The fileUrl parameter
The intended URL of the file to export the attribute to.
Exports the given attribute to a file at the set filepath.
The key parameter
The key of the attribute to export.
The filePath parameter
The intended path of the file to export the attribute to.
Update or add an attribute to the JPEG image.
The key parameter
The key of the attribute to add to the JPEG image.
The value parameter
The value of the attribute to add.
See also value().
Adds a list of attibutes to the JPEG image.
The values parameter
A list of values to set in a JPEG image.
See also values().
Retrieves the defined attribute's value from the JPEG image.
The key parameter
The key of the attribute to retrieve the value of.
See also setValue().
Retrieves a number of attributes from a JPEG image.
The keys parameter
The list of keys to attributes to retrieve values from.
Retrieves a single attribute's value from a JPEG image.
The key parameter
The key of the attribute to return the value of.
See also setValues().