Objects in a browser window

Graham Samuel livfoss at mac.com
Mon Oct 10 17:53:29 EDT 2011


I'm taking up suggestions from this list that I use a browser object to import bitmap images in formats that LC doesn't handle directly, but it's harder than I thought (I've never used a browser object before). My primary delivery target is PC even tho I develop on a Mac.

I have got as far as getting the browser object to open and display a file containing an image: obviously this appears in the window hijacked by the browser object. I need to get this image into my LC app so as to manipulate it by script. To do this, I am trying to use revBrowserSnapshot to import an image from the window used by the browser object. From the docs and my direct experience, it seems that revBrowserSnapshot simply imports the whole browser window. Although there will be nothing else in the window, it might be bigger or smaller than the image. I don't know the image size in advance - a user might choose any size of image to import.

I want to import the image exactly as it is without it being cropped or artificially expanded with white space. Considering the properties of the underlying browsers, if I were doing this by hand on a Mac, I would right-click the image and copy it using a context menu; and on a PC I suppose I would stretch out the browser window so that it exactly showed the image without scrollbars and then snapshot it, but I can't see how to do it by script without an entirely separate investigation of the size of the image I'm trying to show. Such an investigation would involve knowing the way this size info is stored in different file formats and is potentially very complicated.

Is there a workaround to all this? Maybe some kind of scripting interface with the browsers? If not I will plough on with non-browser approaches.

All suggestions welcome.

Graham




More information about the use-livecode mailing list