Round trip image from LC to browser widget and back

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Round trip image from LC to browser widget and back

Post by doobox » Sat Apr 16, 2016 8:21 am

Hi guys, You may have noticed from an earlier post I have been wrestling with an app that is utilising the browser widget to do some heavy lifting on image files.
I feel at this point I need to tack a step back and take some advice on best practices.

Basically I'd like to accept a user image via drag and drop into my desktop app interface.
So I can easily get the local url of the image file and bring that into an image object in the UI.

I click a button in the UI that I want to open that image in the browser widget.
So at the moment I am having the button trigger a javascript in the local html file I have loaded into the browser widget and I pass the image url, and the script loads that as the src of an image element in the html.

Great from here the script proceeds to do the work on the image using some js libraries I have also loaded into the browser.
All good so far, my image is processed, but it sits in the browser as an image element (now converted to a data image by the way).

The slow bit.!
I can get it back out of the browser using a registered javascript function and bringing that base64 data image back into LC its self then decoding it and saving it to url on disk that the original came from, then reloading the image filename in the UI.. Done..!
Slow.. too slow.

It just feels like I am doing this wrong. There must be a quicker way to get that image back from the browser?
Kind Regards
Gary

https://www.doobox.co.uk

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Round trip image from LC to browser widget and back

Post by jacque » Sat Apr 16, 2016 5:20 pm

I guess the first question is why you need to use a browser at all. What sort of processing is being done to the image?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

doobox
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 284
Joined: Tue May 24, 2011 11:47 pm

Re: Round trip image from LC to browser widget and back

Post by doobox » Sat Apr 16, 2016 5:49 pm

Hi Jacque,

I am passing images to the browser to process them because I can do things with this framework in less than a second it can take LC a minute or more to do to very large images.
http://camanjs.com

The framework can do things like take a photoshop curves preset and apply those curves adjustments to the image in maybe 2 seconds tops in my tests, where it takes LC maybe around 20 seconds just to iterate every pixel without doing anything to it (I tested with the image to greyscale lesson without changing the pixels).
Kind Regards
Gary

https://www.doobox.co.uk

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: Round trip image from LC to browser widget and back

Post by jacque » Sat Apr 16, 2016 6:07 pm

I see, it makes sense then. And it looks like you figured out the problem in your other thread so you're good to go.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”