Snapshot image density
David V Glasgow
dvglasgow at gmail.com
Sat Apr 17 05:23:16 EDT 2021
> On 16 Apr 2021, at 4:17 pm, Richard Gaskin via use-livecode <use-livecode at lists.runrev.com> wrote:
> David V Glasgow wrote:
> > Is it right that import snapshot doesn’t offer image density options
> > as export snapshot does?
> Is the metadata["density"] settable?
> I haven't used it so I can't say, but given how snapshotting works I'd be surprised if it lets us control the pixel density of LC's imaging buffer. My hunch is that it's there to inform other programs which may be used to display the image. I'd love to be wrong on that.
Hmmm maybe I have just completely misunderstood. The parameters dictionary entry for export snapshot says:
object: Any valid object reference.
size: The width,height of the snapshot in pixels.
metadata array: The metadata is an array of metadata. Currently the only key supported is "density" with a value in pixels per inch (ppi).
import snapshot parameters include rectDescription and stackRef, then :
objectRef: Any valid card or control object reference.
sizeDescription: The width and height of the snapshot in pixels, in the form height,width.
no mention of a metadata array
> > should I just export to the temp folder, immediately import, copy to
> > clipboard and proceed as before? Or is there a more elegant route?
> As of v7 or so you can also export to a variable, which can then be used to set the data of an image object without the intermediary file I/O.
Thanks! That is useful to know.
> > are temp folders always available irrespective of the severity of
> > security restrictions which might be imposed?)
> Good question. I don't know; I'd always had the impression that tmp is a sort of free-for-all where sensitive data is understood to be inappropriate. Maybe modern systems sandbox tmp by app?
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
Thanks for the information Richard, I will just have to try it out I guess. Maybe at the weekend.
More information about the use-livecode