Copy link to clipboard
Copied
I have a node file that downloads a static map file as a .png (I have also tried downloading it as a .jpg) and adds it as a layer to a comp via CSInterface. The first time I do so, I consistently get this error:
AEGP Plugin PNGIO Support: PNGIO library error: Unable to decode PNG file (5027 :: 12)
However, the image does import and show up as a layer in the comp. (Also, oddly, it is not visible in the comp until I move the playhead.)
If I try importing again, I do not get the error.
Has anyone else encountered this kind of thing when importing images and/or found a solution?
Copy link to clipboard
Copied
to add to this question, when I try to import a .jpeg or .gif format, why does Importfile always expect a png?
Copy link to clipboard
Copied
I would reference your original post back in March on this (5027::12) error:
AEFP Plugin PNGIO Support Error -- Unable to decode PNG (5027 :: 12)
to add to this question, when I try to import a .jpeg or .gif format, why does Importfile always expect a png?
Shouldn't matter, as long as the format is something that AE support. Are you using the ImportOptions object for importFile?
Pg.75 of the Scripting Guide:
ImportOptions object
new ImportOptions(); new ImportOptions(file);
Description
The ImportOptions object encapsulates the options used to import a file with the Project.importFile methods. See “Project importFile() method” on page 118.
The constructor takes an optional parameter, an ExtendScript File object for the file. If it is not supplied, you must explicitly set the value of the file attribute before using the object with the importFile method. For example:
new ImportOptions().file = new File("myfile.psd");
Attributes | Reference | Description |
importAs | “ImportOptions importAs attribute” on page 76 | The type of file to be imported. |
sequence | “ImportOptions sequence attribute” on page 77 | When true, import a sequence of files, rather than an individ- ual file. |
forceAlphabetical | “ImportOptions forceAlphabetical attri- bute” on page 76 | When true, the “Force alphabetical order” option is set. |
file | “ImportOptions file attribute” on page 76 | The file to import, or the first file of the sequence to import. |
Methods
ImportOptions canImportAs() method
importOptions.canImportAs(type) Description
Reports whether the file can be imported as the source of a particular object type. If this method returns true, you can set the given type as the value of the i m p o r t A s attribute. See “ImportOptions importAs attribute” on page 76.
Parameters
Method | Reference | Description |
canImportAs() | “ImportOptions canImportAs() method” on page 75 | Restricts input to a particular file type. |
type | The type of file that can be imported. An ImportAsType enumerated value; one of: ImportAsType.COMP ImportAsType.FOOTAGE ImportAsType.COMP_CROPPED_LAYERS ImportAsType.PROJECT |
Returns
Boolean.
Example
var io = new ImportOptions(File(“c:\\myFile.psd”));
if io.canImportAs(ImportAsType.COMP);
io.importAs = ImportAsType.COMP;
Copy link to clipboard
Copied
yes, I am, but whenever I use anything other than a .png, I get the following error:
AEGP Plugin PNGIO Support: PNGIO library error: Input file doesn't seem to be a PNG file. (5027 :: 12)
Here is the code:
var importOpts = new ImportOptions(new File(mapLayer));
var importImg = app.project.importFile(importOpts)
app.project.item(1).layers.add(importImg);
Copy link to clipboard
Copied
For what it's worth/in case anyone else runs into this issue, it turned out to be an "async" issue; I solved it by splitting the importing of the image and the adding of the image as a layer into separate functions, and on the js side via CSInterface, made the add image function a callback of the import image.
Copy link to clipboard
Copied
Well, scratch that, the PNGIO error still happens, but less frequently. Does anyone know of a way to suppress error messages, or a scriptable way to simulate an "enter" keypress?
beginSuppressDialog() doesn't work for this kind of modal, and the traditional JS method of
document.createEvent("KeyboardEvent");
doesn't work in extendScript
Copy link to clipboard
Copied
I know I'm kind of an echo chamber in here but I'm just trying to find a solution however I can. So, has anyone used initKeyboardEvent in ExtendScript, or is there a way to create an eventListener to detect an error window opening?
Copy link to clipboard
Copied
i have the same issue
Find more inspiration, events, and resources on the new Adobe Community
Explore Now