Skip to main content
Alan_AEDScripts
Inspiring
February 5, 2013
Question

Unable to create temporary image error

  • February 5, 2013
  • 3 replies
  • 8394 views

Hi there, I recently started embedding images in my scripts...

Today for some reason, AFX doesn't like loading any scripts with embedded graphics...

"Unable to load temporary image file" is the message I am getting.

and the script crashes...  restarted, AFX, ESTK and pc ... same deal.

Any idea what is causing the conflict....?

Thanks

Alan.

This topic has been closed for replies.

3 replies

edya32824747
Participant
January 26, 2017

Hi,

I need your help, i want convert a png to a string, like this; u0089PNG..... etc

would you please help me ? I´m new in javascript

Thanks

Inspiring
February 18, 2013

Hi,

I think you can create a temp image, and write the image data into the temp image, then you can just load the temp image.

Here's an example

var win = new Window ("dialog", "Icon Button Example");

win.alignment = ["fill","fill"];

var grp1 = win.add ("group");

//store the data in a variable.

var tempImage = "\u0089PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\u00EE\x00\x00\x003\b\x02\x00\x00\x00\x1F,\u00A3\u0084\x00\x00\x00\x01sRGB\x00\u00AE\u00CE\x1C\u00E9\x00\x00\x00\x04gAMA\x00\x00\u00B1\u008F\x0B\u00FCa\x05\x00\x00\x00\tpHYs\x00\x00\x0E\u00C3\x00\x00\x0E\u00C3\x01\u00C7o\u00A8d\x00\x00\x02%IDATx^\u00ED\u009B\u00DBn\u0083@\f\x05\u00F9\u00FF\u009FN\u0093\u0097JI \u0082\u00B5=\u00B0fx\u00AB\u00C4\u00FA2g\u0082z\u00A1\u00CB\u00C3K\x02-\b,-\u00B6p\t\t<TY\t\u009A\x10P\u00E5&A\u00BA\u0086*\u00EB@\x13\x02\u00AA\u00DC$H\u00D7Pe\x1DhB@\u0095\u009B\x04\u00E9\x1A\u00AA\u00AC\x03M\b\u00A8r\u0093 ]C\u0095i\x07\u0096\u00F7\u008Bn\u00DF\u00B7\u009F*\u00A3\u00D9~x\u00BC\u00F5%:S\u0097f\u00AA\u008C&\u00B9S\u00E5\u00D5\u00DB\u00D0A'l\u00A6\u00CAhh\x11\u0095\u00F5\u00FBwT\u00AA<\u00B7\u00CA\u00FA\u00FD\u009F\u009F*\u009F\u00A9\u00F2\u00B3w\u00FAs\u00FA\u00B6\u00DF\x7F\u00A3*c\u00B1\u00CD\u00D2h\u00EBc\u0084\u00CD\u008F~\u008E\u008B\u009Bq*c\u00F1L\u00D4\u00E8P\u00B8\u00D8^\u0087\u00A6\u00BA\u00CE\u00CD\u00AA\u008C\x19\u00B2\u00D2(\u00EE\x016}|\u00D4\u00EA\n\u00AA\u008C\u00C9P\u00A2\u00F2\u00AA\x1F\u00D8J\u00D5v\x1E\u00AA\u00AF\u00CAX\u00EE\u009F\u008D\x0E\u00E5\x14\u00BC\u0099\\28\u00EA\u00F0\u00F1\u00D3T\x1E\u009E\u00D8\u0083Y\x040\u00BF\u00B3\x06\u00BE\u00CA\u00EF\u0095}\u00F7\u0080I4\u00D8e^\u00BF}*\x07\u00A3\u00BF\u00C5\u00F1:\u00BF\x13\u00F1\u00A9r\"\u00CC{\u0095\u00CA\u00F2;\u008B\u009A*g\u0091\u00BCc\u009D\x14\u009B\u00B3\u00C0\u00A9r\x16\u00C9\u00E6uR\u00AC\u00FD.\u0092HM\u0095\x13a6)Udm\u00A9\u00C7O\u00F4\u00AA\u00DC\u00C4\u00BF\u00B15&\u00B5v\u00FD\x0FCc\b\x06Na\u00D4fi4\u00C00r\x04\u00C3\x12\x192r\u00F6\u00B4\u00A72F\u00F6\u00CA\u008D\"\u00C9\u00FD8\u008B\u00AD\\4\u00FFXYU\u00C6r/y\x07\x03\u009B~L/\u00F2\u0094*c2DU\u00C6\x06%\u00FDK\u00EC\u00C5\u00A9\u00FC\u00FA\x19\u00D3\u00EB\u009D\u00C0V\u0090\x18\u00A7D\u0093N/\u0085\u00AA|\u00FA\u00B6\u00A7\x0F\u00F0\u00FD\"\u008A\u00D6f\u0085\u00A2\u00CAY$w\u00D5a\u00C4\u00DD5J\u00BB\u009BT\x19\u008D4]et\u00FAk7Se4\u009F\u0088\u00CA\u00E8\u00A0\x136Se4\u00B4\u009D*\u00A33ui\u00A6\u00CAt\u0092\u00FE\x0BB\x11qU.\x02kY\u009A\u0080*\u00D3\u00C4\u00EDWD@\u0095\u008B\u00C0Z\u0096&\u00A0\u00CA4q\u00FB\x15\x11P\u00E5\"\u00B0\u0096\u00A5\t\u00A82M\u00DC~E\x04T\u00B9\b\u00ACei\x02\u00AAL\x13\u00B7_\x11\x01U.\x02kY\u009A\u0080*\u00D3\u00C4\u00EDWD@\u0095\u008B\u00C0Z\u0096&\u00F0\x07\u0088TW@\u00CC4\x14\u0090\x00\x00\x00\x00IEND\u00AEB`\u0082";

//create a temporary image file before displaying it.

myFile = new File(File($.fileName).path + "/tempImage.png");

myFile.encoding = "BINARY";

myFile.open( "w" );

myFile.write( tempImage );

myFile.close();

//displaying it.

grp1.add("iconbutton", undefined, myFile);

//no longer need the file, remove it.

myFile.remove();

win.show ();

Let me know if it help

Alan_AEDScripts
Inspiring
February 18, 2013

Hi there, thanks for that but the code isn't the issue - it's something else that we havn't been able to solve -

could be Adobe updates /windows updates/ some kind of conflict etc.

I have posted on the InDesign forum too - nothing has come back yet.

Have seen a couple of posts on PS too where people are experiencing this.

I don't exactly know how to define it as a bug, if it is only happening to certain people.

I'm on CS5.5 Win x64 (7)

It was working fine - might have to do a system resore or something.... or just forget about embedding images.

Known Participant
April 10, 2013

Running into this problem too. Any solutions yet?

Legend
February 5, 2013

Hard to say really, what version AE and OS are you running? My first guess is that maybe the source image's file permissions or it's parent folder permissions may have changed somehow causing an error. Place a try/catch around all your image retrieval code and see if you can get more clearer info about the issue.

try{

//your code

}catch(err){

alert("Error at line " + err.line.toString() + "/n" + err.toString());

}

Alan_AEDScripts
Inspiring
February 5, 2013

Hi David - using a try/catch reports the same...

"Unable to load temporary image file"

I am using a binary string to represent the image....

//=======================================================

var imageSettings="\u0089PNG\r\n\x1A\n\x00\x00\x00   etc

var b7= pnl.add("iconbutton",undefined,imageSettings);

//=======================================================

So it's not permissions as I'm not actually using the file...

It was working yesterday.. and now it's not - maybe my ESTK is the problem...

Legend
February 5, 2013

Quite possibly it is ESTK. I know results will differ sometimes in it versus AE, which is why I always test my code directly in AE via a dummy placeholder script that I can save to repeatedly, but still be able to launch it from the script menu without relaunching AE each time.

I would also verify that the image binary isn't missing a character or got wrapped to a new line and broke the string by chance.