Re: Images and Image Data

2002-07-07 Thread Richard Gaskin

If anyone has time on their hands, I found some useful resources on image
filter algorithms:

Image Processing: Algorithms


The Filter Factory Programming Guide



-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 2.0: Publish any Database on Any Site
 ___
 [EMAIL PROTECTED]   http://www.FourthWorld.com
 Tel: 323-225-3717   AIM: FourthWorldInc

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-06 Thread Yennie

I have a strong feeling that this won't be fixable- since imageData points to 
actual bytes in memory which happen to lie differently on Windows and Mac 
platforms.
Luckily, once can always test "the platform" and proceed accordingly- I think 
you'll find Macs agree with UNIX and LINUX, and Windows is the odd-ball.

Brian

<< My pleasure, but I just discovered that the order of bytes in the imageData

is *different* on Windows than it is on Mac. On Windows it's BGRO, and on

Mac, it's ORGB. Something having to do with "big endian/little endian"

issues, I believe. This has already been sent to Scott; hopefully it will be

fixed soon. >>

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-06 Thread Ken Ray

My pleasure, but I just discovered that the order of bytes in the imageData
is *different* on Windows than it is on Mac. On Windows it's BGRO, and on
Mac, it's ORGB. Something having to do with "big endian/little endian"
issues, I believe. This has already been sent to Scott; hopefully it will be
fixed soon.

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 06, 2002 2:21 PM
Subject: Re: Images and Image Data


> << Brian, that's awesome! How long have you know this and not told anyone?
> ;-) >>
>
> For about 10 minutes after I played with much uglier scripts (try building
> aData by concatenating it with itself- binary speed but UGLY script).
> And about 10 minutes before I posted it =).
>
> Anyway, thanks for being the intrepid soul to start the ball rolling.
>
> Brian
> ___
> metacard mailing list
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/metacard
>

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-06 Thread Yennie

<< Brian, that's awesome! How long have you know this and not told anyone? 
;-) >>

For about 10 minutes after I played with much uglier scripts (try building 
aData by concatenating it with itself- binary speed but UGLY script).
And about 10 minutes before I posted it =).

Anyway, thanks for being the intrepid soul to start the ball rolling.

Brian
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-06 Thread Yennie

<< set the blendlevel of img "someimage" to 75 >>

Because alphaData is our new favorite toy!
No, seriously- the only reason I can think of would be to allow the use of an 
ink other than "blend". Or, to get more complex and vary the opacity across 
the image.

I don't suggest replacing blendLevel with an alphaData solution, unless you 
are shooting for something more complex. Of course, it doesn't hurt either.

Apples and oranges, mostly.

Brian
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



RE: Images and Image Data

2002-07-05 Thread Chipp Walters

Why don't you just do

set the blendlevel of img "someimage" to 75

Does the same thing on my Windows machine.
?

> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED]
> Sent: Friday, July 05, 2002 6:20 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Images and Image Data
>
>
> While we are still on this thread... (thanks Ken, Scott- cool stuff)...
>
> If you want to use alphaData to adjust the opacity of images,
> this works real
> fast:
>
> setprop opacity x
>   put min(100,x) into x
>   put max(1,x) into x
>   put the alphaData of me into aData
>   replace (char 1 of aData) with binaryEncode("C",(255*x/100)) in aData
>   set the alphaData of me to aData
> end opacity
>
> Then just say:
> ## 75% opacity
> set the opacity of image "someImage" to 75
>
> DISCLAIMER: don't use this method if you do anything which sets alphaData
> values which vary anywhere within the alphaData. If you do, you
> can do this,
> which is still faster than building byte-by-byte:
>
> put binaryEncode("C",(255*x/100)) into x
> repeat with i=1 to 255
>   replace numToChar(i) with x in aData
> end repeat
>
> Best Regards,
> Brian
> ___
> metacard mailing list
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/metacard
>

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-05 Thread Ken Ray

Brian, that's awesome! How long have you know this and not told anyone? ;-)

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/

- Original Message -
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, July 05, 2002 6:19 PM
Subject: Re: Images and Image Data


> While we are still on this thread... (thanks Ken, Scott- cool stuff)...
>
> If you want to use alphaData to adjust the opacity of images, this works
real
> fast:
>
> setprop opacity x
>   put min(100,x) into x
>   put max(1,x) into x
>   put the alphaData of me into aData
>   replace (char 1 of aData) with binaryEncode("C",(255*x/100)) in aData
>   set the alphaData of me to aData
> end opacity
>
> Then just say:
> ## 75% opacity
> set the opacity of image "someImage" to 75
>
> DISCLAIMER: don't use this method if you do anything which sets alphaData
> values which vary anywhere within the alphaData. If you do, you can do
this,
> which is still faster than building byte-by-byte:
>
> put binaryEncode("C",(255*x/100)) into x
> repeat with i=1 to 255
>   replace numToChar(i) with x in aData
> end repeat
>
> Best Regards,
> Brian
> ___
> metacard mailing list
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/metacard
>

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-05 Thread Yennie

While we are still on this thread... (thanks Ken, Scott- cool stuff)...

If you want to use alphaData to adjust the opacity of images, this works real 
fast:

setprop opacity x
  put min(100,x) into x
  put max(1,x) into x
  put the alphaData of me into aData
  replace (char 1 of aData) with binaryEncode("C",(255*x/100)) in aData
  set the alphaData of me to aData
end opacity

Then just say:
## 75% opacity
set the opacity of image "someImage" to 75

DISCLAIMER: don't use this method if you do anything which sets alphaData 
values which vary anywhere within the alphaData. If you do, you can do this, 
which is still faster than building byte-by-byte:

put binaryEncode("C",(255*x/100)) into x
repeat with i=1 to 255
  replace numToChar(i) with x in aData
end repeat

Best Regards,
Brian
___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-05 Thread Scott Raney

On Fri, 5 Jul 2002 [EMAIL PROTECTED] wrote:

> Would this run faster?

Definitely, but there's one other optimization: Don't call
binaryEncode so much, it's pretty expensive:

> on mouseUp
>   put fld "data" into tOrigData
>   set the itemdelimiter to TAB
>   create image
>   put it into tID
>   set the width of tID to tWidth
>   set the height of tID to tHeight

local tbp, tgp
put binaryEncode("",0,0,255,0) into tgp
put binaryEncode("",0,0,0,255) into tbp

>   put empty into iData
>   repeat for each line l in tOrigData
> repeat for each item i in l

  if i > 0 then put tgp after iData ---make green
  else put tbp after iData  --- make blue

> end repeat
>   end repeat
>   set the imageData of tID to iData
> end mouseUp

Regards,
  Scott

> Philip Chumbley


Scott Raney  [EMAIL PROTECTED]  http://www.metacard.com
MetaCard: You know, there's an easier way to do that...


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-04 Thread Richard Gaskin

Michael Crawford wrote:

> 
> 
> I have a little project in which I want to convert an array of numbers from
> a text file into an image file. This will be done by making the highest
> number white and the lowest number in the array black. The number in
> between will be assigned a grey value depending on the amount.
> 
> For example 100,50,0,50,100 would make an image 1 pixel high and 5 pixels
> across. The end pixels would be white the middle one black and the ones
> either side 50% grey.
> 
> Manipulating the numbers is fine but generating the image from those
> numbers is proving problematic. I can see that you should use the ImageData
> property to do this but how just seems  completely beyound me at the moment.
> 
> Does any one have any examples or pointers on how I should go about doing
> this?

You must have missed this post from Ken yesterday -- sounds like just what
the doctor ordered:

-
From: Ken Ray 
*Subject: Fun With ImageData, MaskData and AlphaData
*Date: Tue, 02 Jul 2002 22:14:19 -0700



Just wanted to let you all know that I've been working with these cool
image-manipulation features of MetaCard and wrapped my head around them
enough to write up a treatise on how to use them along with some examples.
Here's the relevant links to the Tips section of the MetaCard page of my
site to those who are interested :

http://www.sonsothunder.com/devres/metacard/metacard.htm

Click on the following links:

imag003 - Understanding ImageData, MaskData and AlphaData
imag004 - Making a Single Color Transparent Using MaskData
imag005 - Making an Image Translucent Using AlphaData

Enjoy!

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/
-

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Custom Software and Web Development for All Major Platforms
 Developer of WebMerge 2.0: Publish any Database on Any Site
 ___
 [EMAIL PROTECTED]   http://www.FourthWorld.com
 Tel: 323-225-3717   AIM: FourthWorldInc

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Re: Images and Image Data

2002-07-03 Thread Ken Ray

Michael,

Check out my "tutorial" on imageData at:

http://www.sonsothunder.com/devres/revolution/revolution.htm

Click on the following links on that page:
 imag003 - Understanding ImageData, MaskData and AlphaData

as a start to get a handle on how to manipulate imageData.

What you're going to want to do in your script is:

1) Create an image object with no image in it.
2) Use the binaryEncode() function to create binary values for each pixel of
the image to be created and store it in a variable.
3) Set the imageData of the image object to the variable that contains the
binary.

Here's an example of a script that creates a 20x20 image that is pure blue:

on mouseUp
  create image
  put it into tID
  set the width of tID to 20
  set the height of tID to 20
  put empty into iData
  repeat with i = 1 to 20
repeat with j = 1 to 20
  put binaryEncode("",255,0,0,0) after iData
end repeat
  end repeat
  set the imageData of tID to iData
end mouseUp

Hope this helps,

Ken Ray
Sons of Thunder Software
Email: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/


- Original Message -
From: "Michael Crawford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 03, 2002 11:46 PM
Subject: Images and Image Data


>
>
> I have a little project in which I want to convert an array of numbers
from
> a text file into an image file. This will be done by making the highest
> number white and the lowest number in the array black. The number in
> between will be assigned a grey value depending on the amount.
>
> For example 100,50,0,50,100 would make an image 1 pixel high and 5 pixels
> across. The end pixels would be white the middle one black and the ones
> either side 50% grey.
>
> Manipulating the numbers is fine but generating the image from those
> numbers is proving problematic. I can see that you should use the
ImageData
> property to do this but how just seems  completely beyound me at the
moment.
>
> Does any one have any examples or pointers on how I should go about doing
this?
>
> Thanks
>
> Michael
>
>
> ___
> metacard mailing list
> [EMAIL PROTECTED]
> http://lists.runrev.com/mailman/listinfo/metacard
>

___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



Images and Image Data

2002-07-03 Thread Michael Crawford



I have a little project in which I want to convert an array of numbers from
a text file into an image file. This will be done by making the highest
number white and the lowest number in the array black. The number in
between will be assigned a grey value depending on the amount.

For example 100,50,0,50,100 would make an image 1 pixel high and 5 pixels
across. The end pixels would be white the middle one black and the ones
either side 50% grey.

Manipulating the numbers is fine but generating the image from those
numbers is proving problematic. I can see that you should use the ImageData
property to do this but how just seems  completely beyound me at the moment.

Does any one have any examples or pointers on how I should go about doing this?

Thanks

Michael


___
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard