Skip to main content
tardigrade01
Inspiring
September 8, 2016
Question

AEGP Plugin PNGIO Support... Unable to decode PNG file

  • September 8, 2016
  • 3 replies
  • 7759 views

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?

This topic has been closed for replies.

3 replies

Participant
June 12, 2022

i have the same issue

 

Legend
September 8, 2016

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;

tardigrade01
Inspiring
September 8, 2016

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);

tardigrade01
Inspiring
September 9, 2016

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.

tardigrade01
Inspiring
September 8, 2016

to add to this question, when I try to import a .jpeg or .gif format, why does Importfile always expect a png?