Skip to main content
Known Participant
April 15, 2021
Question

How to transform a binary image into jpg or png in script

  • April 15, 2021
  • 1 reply
  • 771 views

There is a way to transform a binary image into jpg or png via script?

 

I tried to do this by inserting the binary image but it returns an error look;

 


// =======================================================
var idPlc = charIDToTypeID( "Plc " );
var desc873 = new ActionDescriptor();
var idIdnt = charIDToTypeID( "Idnt" );
desc873.putInteger( idIdnt, 110 );
var idnull = charIDToTypeID( "null" );

var image1_imgString = // here would be the binary image

desc873.putPath( idnull, new File( image1_imgString ) );

var idFTcs = charIDToTypeID( "FTcs" );
var idQCSt = charIDToTypeID( "QCSt" );
var idQcsa = charIDToTypeID( "Qcsa" );
desc873.putEnumerated( idFTcs, idQCSt, idQcsa );
var idOfst = charIDToTypeID( "Ofst" );
var desc874 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc874.putUnitDouble( idHrzn, idPxl, 0.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc874.putUnitDouble( idVrtc, idPxl, 0.000000 );
var idOfst = charIDToTypeID( "Ofst" );
desc873.putObject( idOfst, idOfst, desc874 );
executeAction( idPlc, desc873, DialogModes.NO );

 




This topic has been closed for replies.

1 reply

Known Participant
April 15, 2021

did not open

Kukurykus
Legend
April 15, 2021

Of course, you need some pattern that maybe someone will provide over here 😉