Leaving it here with extra options if anyone needs
exportSuperPng(
{
path: Folder.desktop, // required
name: "test-png", // default: document name
quality: 100, // default: 100 (Highest) 82 is High
transparency: true, // default: true
saveMetadata: false,
cleantransparent:true,
pInterlacted:false
})
function exportSuperPng(data, path, name)
{
data.path = path;
data.name = name;
if (data == void(0)) return false;
if (data.path == void(0)) return false;
if (data.quality == void(0)) data.quality = 100;
if (data.name == void(0)) data.name = activeDocument.name;
if (data.transparency == void(0)) data.transparency = true;
if (data.saveMetadata == void(0)) data.saveMetadata = false;
if (data.cleantransparent == void(0)) data.cleantransparent = true;
if (data.pInterlacted == void(0)) data.pInterlacted = false;
if (!getSuperPngInfo()) return false;
var desc = new ActionDescriptor();
var descSPng = new ActionDescriptor();
descSPng.putInteger(charIDToTypeID('pngC'), 9); // ??
descSPng.putInteger(charIDToTypeID('pngF'), 248); // ??
descSPng.putInteger(charIDToTypeID('pngS'), 0); // ??
descSPng.putBoolean(charIDToTypeID('pngQ'), true); // ??
descSPng.putInteger(charIDToTypeID('pngq'), data.quality); // quality
descSPng.putEnumerated(charIDToTypeID('pngA'), charIDToTypeID('alfT'), data.transparency ? charIDToTypeID('alfT') : charIDToTypeID('alfN'));
descSPng.putBoolean(charIDToTypeID('pngX'), data.cleantransparent);
descSPng.putBoolean(charIDToTypeID('pngI'), data.pInterlacted);
descSPng.putBoolean(charIDToTypeID('pngM'), data.saveMetadata);
desc.putObject(charIDToTypeID('As '), stringIDToTypeID('fnord SuperPNG'), descSPng);
desc.putPath(charIDToTypeID('In '), new File(data.path + "/" + data.name + ".png"));
desc.putInteger(charIDToTypeID('DocI'), 475);
desc.putEnumerated(stringIDToTypeID('saveStage'), stringIDToTypeID('saveStageType'), stringIDToTypeID('saveSucceeded'));
executeAction(charIDToTypeID('save'), desc, DialogModes.NO);
function getSuperPngInfo()
{
var sysInfo = app.systemInformation.split("\n");
for (var i = sysInfo.length - 1; i >= 0; i--)
{
if (sysInfo[i].indexOf('SuperPNG') != -1)
{
return true
}
}
return false
}
};
exportSuperPng();