snapshot and imageData...

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

snapshot and imageData...

jbv-2
Hi list,

when using
    import snapshot from rect (the screenrect)

as well as
    export snapshot from rect (the screenrect) to myVar as JPEG
    put var into img 1

it seems that the imageData of the image object is blank...
I tried with Rev 2,5 and MC 2.4.1

Am I missing something, or is there a way to create the actual
imageData for further image processing ?
I haven't found anything useful in the archives...

Thanks,
JB


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

xtalkprogrammer
The following scripts work fine in Rev 2.7.1.

on mouseUp
   import snapshot from rect (the screenRect)
end mouseUp

on mouseUp
   export snapshot from rect "100,100,200,200" to myVar as PNG
   set the rect of img 1 to "110,110,210,210"
   put myVar into img 1
end mouseUp

Best,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to get your own web store on-line: http://
www.salery.biz/salery.html



Op 31-mei-2006, om 15:07 heeft jbv het volgende geschreven:

> Hi list,
>
> when using
>     import snapshot from rect (the screenrect)
>
> as well as
>     export snapshot from rect (the screenrect) to myVar as JPEG
>     put var into img 1
>
> it seems that the imageData of the image object is blank...
> I tried with Rev 2,5 and MC 2.4.1
>
> Am I missing something, or is there a way to create the actual
> imageData for further image processing ?
> I haven't found anything useful in the archives...
>
> Thanks,
> JB

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

jbv-2


Mark,

yes, it works fine for me too, but as I said before, the imageData
of the imported image seems to blank...
and as the Rev doc says, the image content and the imageData prop.
are in different forms... so it seems that the image content displays,
but the imageData isn't created...

Am I wrong ?

JB

> The following scripts work fine in Rev 2.7.1.
>
> on mouseUp
>    import snapshot from rect (the screenRect)
> end mouseUp
>
> on mouseUp
>    export snapshot from rect "100,100,200,200" to myVar as PNG
>    set the rect of img 1 to "110,110,210,210"
>    put myVar into img 1
> end mouseUp
>
> Best,
>
> Mark
>
> --
>
> Economy-x-Talk
> Consultancy and Software Engineering
> http://economy-x-talk.com
> http://www.salery.biz
>
> Salery is the easiest way to get your own web store on-line: http://
> www.salery.biz/salery.html
>
> Op 31-mei-2006, om 15:07 heeft jbv het volgende geschreven:
>
> > Hi list,
> >
> > when using
> >     import snapshot from rect (the screenrect)
> >
> > as well as
> >     export snapshot from rect (the screenrect) to myVar as JPEG
> >     put var into img 1
> >
> > it seems that the imageData of the image object is blank...
> > I tried with Rev 2,5 and MC 2.4.1
> >
> > Am I missing something, or is there a way to create the actual
> > imageData for further image processing ?
> > I haven't found anything useful in the archives...
> >
> > Thanks,
> > JB
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

--



_________________________
Faith is a central nervous system disease, like Alzheimer or multiple sclerosis.


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

xtalkprogrammer
Hi JB...

Why do you think that the imagedata of the imported image are  
blank...? What should I do to see what you see...? Here, the  
imagedata of the image are not blank... (do you mean empty...?)...  
where do the docs say that the imagedata and image content are  
different...? Try the following script...

on mouseUp
    import snapshot from rect (the screenRect)
    put length(the imagedata of img 1)
end mouseUp

After running this script... the message box contains... 5242880.  
So... I think you do something wrong...

Best...

...Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to get your own web store on-line: http://
www.salery.biz/salery.html



Op 31-mei-2006, om 16:13 heeft jbv het volgende geschreven:

>
>
> Mark,
>
> yes, it works fine for me too, but as I said before, the imageData
> of the imported image seems to blank...
> and as the Rev doc says, the image content and the imageData prop.
> are in different forms... so it seems that the image content displays,
> but the imageData isn't created...
>
> Am I wrong ?
>
> JB
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

jbv-2


Mark,

yes, you're right; but try this :

on mouseUp
    import snapshot from rect (the screenRect)
    put length(the imagedata of img 1)

    create img
    set rect of img 2 to rect of img 1
    set imageData of img 2 to imageData of img 1
end mouseUp

the 2nd image is just a black rect; although the imagedata
contains more than 5 Mb of binary, it seems that they're
all zeros...

as for Rev doc, just have a look at what it says for imageData
(bottom of the screen)...

JB

> Hi JB...
>
> Why do you think that the imagedata of the imported image are
> blank...? What should I do to see what you see...? Here, the
> imagedata of the image are not blank... (do you mean empty...?)...
> where do the docs say that the imagedata and image content are
> different...? Try the following script...
>
> on mouseUp
>     import snapshot from rect (the screenRect)
>     put length(the imagedata of img 1)
> end mouseUp
>
> After running this script... the message box contains... 5242880.
> So... I think you do something wrong...
>
> Best...
>
> ...Mark
>
> --
>
> Economy-x-Talk
> Consultancy and Software Engineering
> http://economy-x-talk.com
> http://www.salery.biz
>
> Salery is the easiest way to get your own web store on-line: http://
> www.salery.biz/salery.html
>
> Op 31-mei-2006, om 16:13 heeft jbv het volgende geschreven:
>
> >
> >
> > Mark,
> >
> > yes, it works fine for me too, but as I said before, the imageData
> > of the imported image seems to blank...
> > and as the Rev doc says, the image content and the imageData prop.
> > are in different forms... so it seems that the image content displays,
> > but the imageData isn't created...
> >
> > Am I wrong ?
> >
> > JB
> >
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

--



_________________________
Faith is a central nervous system disease, like Alzheimer or multiple sclerosis.


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

Dar Scott

On May 31, 2006, at 8:48 AM, jbv wrote:

> the 2nd image is just a black rect; although the imagedata
> contains more than 5 Mb of binary, it seems that they're
> all zeros...

It might be that Rev is gagging on the large JPEG.  Perhaps, this  
works better with PNG.

Dar
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

xtalkprogrammer
In reply to this post by jbv-2
JB,

Your script works fine here. I don't know why it wouldn't work for  
you. Did you restart Revolution and try this script again in an  
otherwise empty stack? Maybe, you machine is too slow, you don't have  
enough memory available, or maybe you have an empty image on your  
card which you forgot about. Without more information, there is  
nothing I can do.

Best,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to get your own web store on-line: http://
www.salery.biz/salery.html



Op 31-mei-2006, om 16:48 heeft jbv het volgende geschreven:

>
>
> Mark,
>
> yes, you're right; but try this :
>
> on mouseUp
>     import snapshot from rect (the screenRect)
>     put length(the imagedata of img 1)
>
>     create img
>     set rect of img 2 to rect of img 1
>     set imageData of img 2 to imageData of img 1
> end mouseUp
>
> the 2nd image is just a black rect; although the imagedata
> contains more than 5 Mb of binary, it seems that they're
> all zeros...
>
> as for Rev doc, just have a look at what it says for imageData
> (bottom of the screen)...
>
> JB
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

ScottR
In reply to this post by jbv-2
Recently, jbv wrote:

> when using
>   import snapshot from rect (the screenrect)
>
> as well as
>   export snapshot from rect (the screenrect) to myVar as JPEG
>   put var into img 1
>
> it seems that the imageData of the image object is blank...
> I tried with Rev 2,5 and MC 2.4.1

Testing here with MC 2.4.3 on OSX seems to work as expected.  The length of
the imageData is a number, as opposed to 0.  Are you getting imageData of 0
length?

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: [hidden email]
W: http://www.tactilemedia.com

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

jbv-2
In reply to this post by Dar Scott
yes, there seems to be a speed problem...

in the following example :

on mouseUp
   import snapshot from rect (the screenRect)
   create img
   set rect of img 2 to rect of img 1
   set imageData of img 2 to imageData of img 1
end mouseUp

it looks like lines 2 to 4 are executed before the
completion of the snapshot, hence the "blank" imageData...

I wonder if there's a way to know when the "import snapshot"
is completed to start further processing of the imageData...

Actually, snapshots of large screen is a rather slow process,
and my goal is to loose as little time as possible...

JB

> On May 31, 2006, at 8:48 AM, jbv wrote:
>
> > the 2nd image is just a black rect; although the imagedata
> > contains more than 5 Mb of binary, it seems that they're
> > all zeros...
>
> It might be that Rev is gagging on the large JPEG.  Perhaps, this
> works better with PNG.
>
> Dar
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

--



_________________________
Faith is a central nervous system disease, like Alzheimer or multiple sclerosis.


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

Francis Nugent Dixon
In reply to this post by jbv-2
Hi from Paris,

I agree about Rev gagging on large JPEG files, and
coming up with a black rect.

> On May 31, 2006, at 8:48 AM, jbv wrote:
>
>> the 2nd image is just a black rect; although the imagedata
>> contains more than 5 Mb of binary, it seems that they're
>> all zeros...
>
> It might be that Rev is gagging on the large JPEG.  Perhaps, this
> works better with PNG.

I had to scale down many of my JPEG files with
GraphicConverter to get them visible in my stack.
If the JPEG is less than 500K, then display is almost
immediate. If it is over 2 megs, be prepared for a long
wait - and the dreaded black rect afterwards (Mac G4 733)!
2 meg colour photos from my Sony digital, scaled down
to less than a meg work beautifully. Strangely enough,
high volume Black & White photos seem prone to this
problem, although I haven't quite fathomed out the whys
and whens ! It seems as if most of my problems come
from scanned B & W photos (HP ScanJet 7400). I may
rescan these using a different quality. I also use a little
routine to scale the "too tall - too wide" photos into the
smaller wondow. This may not help either. I will try PNGs
when I get some time !

-Francis

"Nothing should ever be done for the first time !"

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

Dar Scott
In reply to this post by jbv-2

On May 31, 2006, at 12:45 PM, jbv wrote:

> I wonder if there's a way to know when the "import snapshot"
> is completed to start further processing of the imageData...

Candidates might be...

     unlock screen
     wait

Dar Scott
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

Jim Ault
Could decoding the RGB of one of the last 10 pixels help?  This assumes that
Rev processes from first to last of the image length.

Jim Ault
Las Vegas

On 5/31/06 12:57 PM, "Dar Scott" <[hidden email]> wrote:

>
> On May 31, 2006, at 12:45 PM, jbv wrote:
>
>> I wonder if there's a way to know when the "import snapshot"
>> is completed to start further processing of the imageData...
>
> Candidates might be...
>
>      unlock screen
>      wait
>
> Dar Scott


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

jbv-2


> Could decoding the RGB of one of the last 10 pixels help?  This assumes that
> Rev processes from first to last of the image length.
>
> Jim Ault
> Las Vegas

yep... this also assumes that you never have 10 black pixels at
the bottom right of your screen...

JB

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

Chipp Walters
In reply to this post by jbv-2
Why not just do this?

on mouseUp
   import snapshot from rect (the screenRect)
   put length(the imagedata of img 1)

   create img
   put img 1 into img 2
end mouseUp
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

jbv-2


Hi Chipp,

I already tried that but it doesn't work : when "import snapshot"
is executed, a new image object is created with an imagedata of
right length, but its content doesn't match the image content of
the snapshot; instead it's filled with zeros (the default imagedata
for a newly created image I guess), hence the black image displayed
when executing "put img 1 into img 2"...

my problem is still to know when the imagedata contains the right
data...

JB

> Why not just do this?
>
> on mouseUp
>    import snapshot from rect (the screenRect)
>    put length(the imagedata of img 1)
>
>    create img
>    put img 1 into img 2
> end mouseUp

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

Chipp Walters
jbv,

I tried this and it works just fine:

on mouseUp
  put the screenRect into tRect
   import snapshot from rect tRect
   create img
   put img 1 into img 2
end mouseUp

The trick is to create the var tRect first before using the import
snapshot command.

best,
Chipp
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

jbv-2


Chipp,

Thanks for the tip.

For those interested, I've found a (slightly) different
but (slightly) faster way to do this :

on mouseUp
  put the screenrect into tRect
  export snapshot from rect tRect to var as JPEG
  create img
  put var into img 1
end mouseUp

the difference is probably because only 1 image
object is created...

JB


> jbv,
>
> I tried this and it works just fine:
>
> on mouseUp
>   put the screenRect into tRect
>    import snapshot from rect tRect
>    create img
>    put img 1 into img 2
> end mouseUp
>
> The trick is to create the var tRect first before using the import
> snapshot command.
>
> best,
> Chipp
> _______________________________________________

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

xtalkprogrammer
Hi JB,

Why did you originally want to create two images? I had the  
impression that your goal was to have two image objects. Also, why do  
you use JPEG instead of PNG?

Best,

Mark

--

Economy-x-Talk
Consultancy and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Salery is the easiest way to get your own web store on-line: http://
www.salery.biz/salery.html



Op 4-jun-2006, om 12:07 heeft jbv het volgende geschreven:

>
>
> Chipp,
>
> Thanks for the tip.
>
> For those interested, I've found a (slightly) different
> but (slightly) faster way to do this :
>
> on mouseUp
>   put the screenrect into tRect
>   export snapshot from rect tRect to var as JPEG
>   create img
>   put var into img 1
> end mouseUp
>
> the difference is probably because only 1 image
> object is created...
>
> JB
>

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Kind regards,

Drs. Mark Schonewille

Economy-x-Talk Consultancy and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
Facebook: http://facebook.com/LiveCode.Beginner
KvK: 50277553
Reply | Threaded
Open this post in threaded view
|

Re: snapshot and imageData...

jbv-2


Mark,

My original goal was to get the imagedata of a snapshot as fast
as possible.
I first tried with "import snapshot" but realized that it didn't
produce any valid imageData.
Then I thought that may be creating a 2nd image and putting
the image content of the snapshot into the 2nd image would
create a valid imagedata... But it doesn't... unless you first
create a tRect variable for the rect of the snapshot...

And finally, I use JPEG because I don't need any transparency,
although I just realized that PNG versions of screenshots have
a smaller size than JPEGs, but the process is also somewhat
longer, and I need to do it as fast as possible...

BTW, could someone explain why the tRect variable needs to
be created before executing "import snapshot" in order to get a
valid imagedata ?
I'm probably dumb, but I really don't get it...

Best,
JB

> Hi JB,
>
> Why did you originally want to create two images? I had the
> impression that your goal was to have two image objects. Also, why do
> you use JPEG instead of PNG?
>
> Best,
>
> Mark
>
> --
>
> Economy-x-Talk
> Consultancy and Software Engineering
> http://economy-x-talk.com
> http://www.salery.biz
>
> Salery is the easiest way to get your own web store on-line: http://
> www.salery.biz/salery.html
>
> Op 4-jun-2006, om 12:07 heeft jbv het volgende geschreven:
>
> >
> >
> > Chipp,
> >
> > Thanks for the tip.
> >
> > For those interested, I've found a (slightly) different
> > but (slightly) faster way to do this :
> >
> > on mouseUp
> >   put the screenrect into tRect
> >   export snapshot from rect tRect to var as JPEG
> >   create img
> >   put var into img 1
> > end mouseUp
> >
> > the difference is probably because only 1 image
> > object is created...
> >
> > JB
> >
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

--



_________________________
Faith is a central nervous system disease, like Alzheimer or multiple sclerosis.


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution