Any suggestions on how to "onion skinning"?

BNig niggemann at uni-wh.de
Mon Dec 3 10:03:45 EST 2007


Ken, 

if you are on MacOSX system > = 10.4 and you just want the image to be
grayscale then you can try an applescript for colorsyncscripting.
it is a lot faster than Revolution. It takes Revolution from "set the
imagedata of image x to y" for a 640x480 on a MacBook Pro 2.3 about 280
Milliseconds to display the image. So whatever you do you have this
overhead. Doing a chartonum 900.000 times doesnt help either.
On the other hand revolution is quite fast in loading a image file and
displaying it.

here is a recipe:

make a new stack with an image, call it "i1", make a field call it "f1",
make a button

put the following applescript into the field f1:

-- thisFile is provided by user in revolution
-- thisFileNewName is provided by user in  revolution

set thisFile to thisFile as alias
set sourceProf to POSIX file "/System/Library/ColorSync/Profiles/Generic RGB
Profile.icc"
set destProf to POSIX file "/System/Library/ColorSync/Profiles/Generic Gray
Profile.icc"

tell application "ColorSyncScripting"
	launch
	try
		-- you can  specify where to save the image in revolution by setting the
variable for thisFileNewName
		match thisFile from source (sourceProf) to destination (destProf) saving
into file thisFileNewName with replacing
	on error errmsg
		activate
		display dialog errmsg
	end try
	set quit delay to 5
end tell

-- end of the applescript

set the script of the button to:

on mouseUp
    -- make shure we are on MacOS X and system version  >= 10.4
    -- because of ColorSyncScripting
    if platform () <> "MacOs" then 
        answer "works only on Macs because of Applescript"
        exit mouseUp
        get  systemversion ()
        if word 1 of it < 10 and word 2 of it < 4 then 
            answer "MacOs X version => 10.4 required"
            exit mouseUp
        end if
    end if
    
    put the millisec into theStart
    
    put the filename of image 1 into theFilename
    if theFilename is "" then exit mouseUp
    
    -- in MacOS X 10.5.1 and Revolution 2.8.1 the filename of the image, if
you chose the image in the inspector
    -- is something like "./../../../Desktop/nameOfTheFile.jpg",
"./../../../" confuses revMacFromUnixPath
    -- so we try to make a viable filename using specialforderpath
    if theFilename contains ".." then
        set the itemdelimiter to "/"
        repeat with i =  the number of items of theFilename down to 1
            if item i of theFilename is "." or item i of theFilename is ".."
then delete item i of theFilename
        end repeat
        put specialfolderpath(cusr) into pathToUser
        put pathToUser & "/" & theFilename into theFilename
    end if
    
    -- now make a name for a new file which will contain the grayscale
picture in the same place where
    -- the original file is, just append " 01" to the file name
    set the itemdelimiter to "."
    put theFilename into thisFileNewName
    put " 01" after item -2 of thisFileNewName
    
    -- convert rev-style path to macintosh path
    put revMacFromUnixPath (theFilename) into theMacFileName
    put revMacFromUnixPath (thisFileNewName) into theMacFileNewName
    
    -- now build the applescript command
    put "set thisFile to " & quote & theMacFileName & quote & return into
tVarForApplescript
    put "set thisFileNewName to " & quote & theMacFileNewName & quote &
return after tVarForApplescript
    put field "f1" after tVarForApplescript  
    do tVarForApplescript as Applescript
    
    if the result <> "" then answer the result
    
    set the filename of image 1 to thisFileNewName
    put the millisec - theStart into msg
end mouseUp 


--------------

in the inspector choose a color jpeg file for the image "i1" then click the
button

if all works as expected the applescript generates a greyscale file from the
original jpeg file in the folder of the original and opens it in the image
"i1"

if you do the conversion on a grayscale file the resulting file will be
broken

to avoid all the confusion with setting the filename of the image i1 from
the inspector in Leopard you may want to make a button with answer file to
set the filename of image i1

I filed a bug report for the filename problem in Leopard

ColorSyncScripting.app is on every mac from 10.4.0 on as far as I know. 





Ken Ray wrote:
> 
> On Wed, 28 Nov 2007 20:19:27 +0000, Ian Wood wrote:
> 
>>>> I'm working on a program with my son that does simple card-based
>>>> animation, but one of the things he asked how to do in Rev stumped me,
>>>> and that is doing an "onion skin"
>>> 
>>> I would try overlaying a translucent screen capture of the prev or next
>>> card.
>> 
>> Agreed. Or do it by taking a snapshot directly from the card - this 
>> should work even if it's not the frontmost card.
> 
> The problem with those is that if the card has color in it, the 
> translucency is also in color. I was hoping to keep it in 
> grayscale/gray.
> 
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 
> 

-- 
View this message in context: http://www.nabble.com/Any-suggestions-on-how-to-%22onion-skinning%22--tf4892376.html#a14131598
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list