Hi guys,
I am working on a script to basically insert a gif as metadata into a fx preset file. If you open Adobe bridge and browse to the After effects text presets you will see that you can click on a preset and in the preview there is an animated GIF. So I am attempting to do this for custom presets.
Basically I think I need to read the contents of a GIF file as data, or text, then encode that as base64 and insert it into the metadata of the preset file.
The problem is when I read in the GIF as data I can't seem to get all the data.
The code I'm using is
Code:
file = new File("C:\\test.gif");
file.open("r");
test = file.read();
alert(test);
And what gets returned is
Code:
GIF89aØ
If I open the gif in notepad I get:
Code:
GIF89aØ ô ÿÿÿ–••øøøòòòìììæææàààÛÛÛÕÕÕÐÐÐÊÊÊÅÅÅ¿¿¿¸¸¸°°°¨¨¨ŸŸŸŒŒŒƒƒƒ{{{rrriii___VVVMMMCCC999///###!ÿNETSCAPE2.0 !ù ÿ , Ø ÿ Ždižhª®lë¾p,Ïtmßx®ï|ïÿÀ pH,ȤrÉl:ŸÐ¨tJZ¯Ø¬vËíz¿à°xL.›Ïè´zÍn»ßð¸|N¯Ûïø¼~Ïïûÿ€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
H° Áƒ*\Ȱ¡Ã‡#JœH±¢Å‹3jÜȱ£Ç CŠI²¤ÉE! !ù ÿ ,! C VàdYJ›Tlë¶HF½4œe¥KM+è:@,JZ›¢Ré9²†Ë¥gÆJF—Î ôJl¶¶\@|õVÃÆ/`Ö®ÅjtÛŠ¯§ñp›|¥è\{ovK! !ù ÿ ,0 I ˆ TŒ`š[3Y‹w—ôÛ,í Å&9q¯jñBœ2ˆEìzÂWK‹Šk Bx0ÀÆk™ ]¬L’kâx¿[ù$.0n&-;
‚&L;E‰ ;AŽ;dŽ yŽ5/
˜CMt'^%‰6_˜L›˜fœ˜! !ù ÿ ,@ H Ž¢·qd dM ’7z,…ì‹MI0›-¿†ÍCô l KOv0P‘Åñ\e™Ô&(X›!‰Óp¾é '{£Õ#¶ÏÛ,„I2|>.$R2g?#H`Œ?‚X“‘?(“‰ƒYpjY7wr)§®$°±Cƒx±p´%«´! !ù ÿ ,C H ë ŠÞÆh
p¦ZP@Öt!y*àQØ'Q@ èùh‹M*³8ú’Bca86p¢Mó'¸4Œ“O€µ’ ©]z€FFY|Ç(GAè4)3?"wP84am#k4'N›I’”#˜ ¡›Gž)–>—D±±ƒ(Z4"º·9s0vFu>ÃÀ>} U‚$†6*X¦Ï€#gŠ
MbØGá)äGP’f>Xªéb“"òÀ$-P¤òG0ÇÀ‚…äK˜ð C‚?>=ô×o"° !ù ÿ ,a I ªàUŒ`R × d*"qE@®U‚KÙ…`akpN[ á9AlÓ/€¢Êª)eë8@‹ J/lð´óJl ©!\ÉÛñà.6 |scPDO,DV[5"%6‡6.&|yG]u7 ˜K
KM««-’5h?#MŠJ€„J
§(SeG&޲Ç/;.yË&! !ù ÿ ,y H
= Ž€·™MQœRPÛâf[Àu ¹.ÅÉ<%ãáä
Òæè!m$À3°ˆNÖ\Õ™Ã*»Y×vt
¼£ !ù ÿ ,„ B 0 x¢(ÁdH,×¾âÖHd©ïÜR
€ÌŠ3$Q˜d.Ê£S
F¯V@ !ù ÿ ,ˆ E bàŒd&q$à¥R[*KÁˤPÃi£¶µ`¡ ðø<º âZ®¢ 1¦’<’/çÊŽ¶#ìí{Ý`€¸wížÓk-kwa“(Qˆ}tA(h2
Ji?JU8$+ ! !ù ÿ ,– H k ŽÞÆèH!A'ʱn½‘K[@T葤…ÈŒ2¬‚àI.Q"À’42™”bC©y]EÉï[+d†-ˆ`Í^K<–Ÿ9•B¦é©†KDõ4c_7$+^0x%& ! !ùF ÿ ,£ H S ޤÇq$…PE •MX‚-{žèA¶šN ˜~º@ArA-zHÛ“„Ø… €È¶- àÄ(ø,öaÛ¾5ü«÷èáõZߢðl$! ;
So am I doing something wrong in reading in the gif? Do I need to specify some sort of encoding?