Initialize a model with an image?
I think I remember you talking about this, but I'm not sure if it's implemented yet? Initializing a model (and its size) from a loaded image? Could you do something like
DataSet.importImageDataSet('my-image', function(dataset) {
new Model('div', 1, dataset.width, 1, dataset.height, 1);
})
?
Woops, sorry to be late responding.
I usually do the image import outside creating the model, just like you show. u.importImage flags.imageName, (img)=> w = flags.scaleWidth; h = Math.round img.height*w/img.width model = new MyModel("layers", 1, 1,w, 1,h, false, false) .debug() # Debug: Put Model vars in global name space .start() # Run model immediately after startup initialization
The flags object is the REST initialization parameters, here the image name and scale.
Note that the image is cached inside agentscript's "file index" so any second use of u.importImage is sync.
-- Owen