Grayed image on the web with the revlet

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
thebluelion
Posts: 2
Joined: Fri Jan 15, 2010 7:54 am

Grayed image on the web with the revlet

Post by thebluelion » Fri Jan 15, 2010 8:02 am

Received from: Harry Wagendorp

Hi,

I used to operate with Hypercard, when it started, then after Hypercard stopped with Supercard. Also I did make a lot of applesctipts.
Then I tried Revolution Media in order to test a multiOs program. Splendid but ......
My built rev works OK, but after saving for the web , the image in the revlet grayed out. No image .....
I tried "Hello World" .... downloaded the rev and saved the revlet and that's OK.

So after I studied a lot of the marvelous documentation and did many searches on the forums but now I feel myself lost.

iMac9,1, Intel Core 2 Duo, 2.93 GHz, 4 GB
MacOs 10.6.2
Safari 4.0.4 in 32 bits mode
rev plugin installed

:shock: Help

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Grayed image on the web with the revlet

Post by Mark » Fri Jan 15, 2010 12:27 pm

Dear Harry,

Make sure that you import the picture as a control, rather than referenced: File menu/Import as Control/Image File...

Btw since you have a Dutch family name, perhaps you're Dutch? There is a Dutch forum at http://runrev.info/rrforum/.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am
Location: Bordeaux, France

Re: Grayed image on the web with the revlet

Post by Dixie » Fri Jan 15, 2010 12:29 pm

the bluelion...

look at http://ihouse.on-rev.com/demo/index.html the web page contains a revlet that has one image object and one button...

the script of the button is

Code: Select all

on mouseUp
set the filename of image 1 to "http://ihouse.on-rev.com/demo/warpaint.jpg
end mouseUp 
because that is filepath to the image 'warpaint.jpg'

be well

Dixie

thebluelion
Posts: 2
Joined: Fri Jan 15, 2010 7:54 am

Re: Grayed image on the web with the revlet

Post by thebluelion » Sat Jan 16, 2010 7:42 am

Thanks for the help, I misinterpreted the import of images.
And yes, I'm Dutch, so I'll look at the Dutch forum.
As proof of the pudding, see: http://idisk.mac.com:80//harrywagendorp ... /test.html
N.B. This testpage will be there for one week.
:D

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Grayed image on the web with the revlet

Post by thatkeith » Fri Mar 05, 2010 10:29 am

Mark wrote:Make sure that you import the picture as a control, rather than referenced: File menu/Import as Control/Image File...
Thanks, this did the trick for me.

One question: is it possible to script the 'conversion' of a big set of graphics from file-referencing things to controls if they are already in a stack?

k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Grayed image on the web with the revlet

Post by bn » Fri Mar 05, 2010 11:14 am

K,
you can "detach" the images from their file reference by setting their imagedata to the imagedata of themselves. (go figure). This does however affect those images that have been scaled down/up and that have their lockloc set to true. They are then set to the scaled size. That is not good if you want to zoom in and out of images or scale them afterwards in any way. To overcome this one sets width/height of the image to the formattedwidth and formattedHeight of the image. That is their original size. Then one sets them back to the current size. This keeps the original image information.
This little script does this, in my test it did worked, you might want to try this on a copy of your stack first and make shure it does not have untoward effects.

Code: Select all

on mouseUp
   push  card
   repeat with c = 1 to the number of cards
      go card c
      repeat with i = 1 to the number of images of this card
         if the filename of image i is not empty then
            lock screen
            put the rect of image i into tCurrentSize
            set the width of image i to the formattedWidth of image i
            set the height of image i to the formattedHeight of image i
            set the imagedata of image i to the imagedata of image i
            set the rect of image i to tCurrentSize
            unlock screen
         end if
      end repeat
   end repeat
   pop  card
end mouseUp
now the images are not referenced anymore but resident in the stack, just like imported.
regards
Bernd

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Grayed image on the web with the revlet

Post by Mark » Fri Mar 05, 2010 11:23 am

Hi Bernd,

I started writing an example script and then decided I didn't have the time to check whether the imagedata would be sufficient. One might want to check the maskdata and alphadata as well. It might also be possible to use the text of the image instead of the imagedata, maskdata and alphadata.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Grayed image on the web with the revlet

Post by bn » Fri Mar 05, 2010 12:49 pm

Hi Mark,
I tried setting the text of image x to the text of image x, somehow it did not work (why?). Imagedata worked. I did not try this at this time, but in former tests the maskdata and the alphadata adjust to the imageData.
Although sometimes imagedata is still baffling me, e.g. when creating an image and strictly painting with the paint tools does not give me imagdata??, text of image works. e.g. testing whether the image has changed.

@ Keith: if you want to crop your referenced images permanently to the size they are displayed at (in case you resized them) you could comment out the formattedWidth/formattedHeight part of the script. It would reduce the size of the stack.

regards
Bernd

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 346
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK
Contact:

Re: Grayed image on the web with the revlet

Post by thatkeith » Tue Mar 23, 2010 2:16 pm

bn wrote:you could comment out the formattedWidth/formattedHeight part of the script. It would reduce the size of the stack.
Hi Bernd - I remember doing this many years ago in SuperCard, setting the pictureData of an image to itself (I forget the exact wording) in order to throw away unnecessary embedded pixel data. Thanks for the script, I'll play with it. It all helps learning and relearning!

k
Technical Writer, Meta
University Lecturer
Technical Editor, MacUser (1996-2015)
360 VR media specialist

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”