ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

convert image to binary code Scripting

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Rainier Raydán
convert image to binary code Scripting
on Mar 6, 2018 at 2:55:56 pm

Hi guys!

I'm trying to add an png image to my script and I do it with this method:



res = "group{orientation:'column', alignment:['fill', 'fill'], alignChildren:['fill', 'fill'],\
myMooco: Group{ orientation:'row', alignment:['right', 'fill'],\
},\

}"
var moocoImg = File ("./MOOCO_LOGO_Script.png");
var icon = myPanel.grp.myMooco.add ('image', undefined, moocoImg);



It works fine but I have problems launching it with the adobe extendscript toolkit CC (if I do it via file+script+runscript it works fine). When I push the play button it gives me the error "invalid image data " from this line:

var icon = myPanel.grp.myMooco.add ('image', undefined, moocoImg);

I supose it doesnt find the image for some reason. Anyway, is there a way to convert images to binary code so I can write that code to mi file and avoid inserting the png file?

Thanks!


Return to posts index

Rainier Raydán
Re: convert image to binary code Scripting
on Mar 6, 2018 at 4:12:45 pm

I've find a way!
Using this incredible script: https://aescripts.com/file-to-binary-converter/

You can convert the png file to a binary string.

just copy all the code between the quotes (dont copy the (new String() ) and paste it inside a variable, then use it to embed it.

var binaryIcon= PASTE CODE HERE ;

var myIcon = myPanel.grp.myGroup.add ('image', undefined, binaryIcon);


Bye!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]