Skip to main content
Participant
December 17, 2020
Question

How to save as jp2 not jpf

  • December 17, 2020
  • 2 replies
  • 944 views

I can not figure this out to save my life. This is in Adobe Photoshop 2021 on a Windows PC.

This topic has been closed for replies.

2 replies

Stephen Marsh
Community Expert
Community Expert
July 23, 2023

The following script can be used if all else fails.

 

It will save as a copy using lossless JP2 compatible settings to the same location as the source file. The file extension will be JPF. If you really wish to use JP2 as the file extension, the placeholder code would need to be uncommented to rename the saved file as Photoshop insists on using JPF, even if JP2 is used as the extension.

 

var docName = activeDocument.name.replace(/\.[^\.]+$/, '');

try {
	var outputPath = activeDocument.path.fsName;
} catch (e) {
	var outputPath = Folder.selectDialog("Unsaved base file, select the output folder:");
}

var saveFileJPF = new File( outputPath + "/" + docName + ".jpf" );

if (saveFileJPF.exists) {
	// true = 'No' as default active button
	if (!confirm("'" + saveFileJPF.name + "' exists, overwrite: Yes or No?", true))
		// throw alert("Script cancelled!");
		throw null;
}

saveJPF();

/*
var theRegEx = saveFileJPF.name.replace(/\.jpf/, '.jp2');
saveFileJPF.rename(theRegEx);
*/


function saveJPF() {
	function c2t(s) {
		return app.charIDToTypeID(s);
	}
	function s2t(s) {
		return app.stringIDToTypeID(s);
	}
	var descriptor = new ActionDescriptor();
	var descriptor2 = new ActionDescriptor();
	descriptor2.putBoolean( c2t( "JPLS" ), false );
	descriptor2.putBoolean( c2t( "JPFM" ), true );
	descriptor2.putBoolean( c2t( "JPMD" ), true );
	descriptor2.putBoolean( c2t( "JPTP" ), false );
	descriptor2.putBoolean( c2t( "JPJC" ), true ); // ? JP2 ?
	descriptor2.putInteger( c2t( "JPEH" ), 50 );
	descriptor2.putInteger( c2t( "JPPO" ), 0 );
	descriptor2.putBoolean( c2t( "JPCS" ), true );
	descriptor2.putInteger( c2t( "JPWF" ), 0 );
	descriptor2.putInteger( c2t( "JPTS" ), 3 );
	descriptor2.putBoolean( c2t( "JPJX" ), false );
	descriptor2.putBoolean( c2t( "JPXM" ), true );
	descriptor2.putBoolean( c2t( "JPEX" ), true );
	descriptor2.putBoolean( c2t( "JPIP" ), true );
	descriptor2.putBoolean( c2t( "JPRP" ), true ); // ? JP2 ?
	descriptor2.putInteger( c2t( "JPEV" ), 0 );
	descriptor2.putInteger( c2t( "JPIS" ), 1 );
	descriptor2.putInteger( c2t( "JPRS" ), 1 );
	descriptor.putObject( s2t( "as" ), s2t( " JPEG 2000" ), descriptor2 );
	descriptor.putPath( s2t( "in" ), new File( saveFileJPF ) );
	descriptor.putBoolean( s2t( "copy" ), true );
	descriptor.putBoolean( s2t( "lowerCase" ), true );
	executeAction( s2t( "save" ), descriptor, DialogModes.NO );
}

 

Info on saving and running script code here:

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

davescm
Community Expert
Community Expert
December 17, 2020

Try manually changing the extension to jp2 in Save As. When you then click "save" you will see the jp2 compatible box is checked and greyed.

 

Dave

Participant
December 17, 2020

Thanks. I totally don't see anywhere to manually change that at all. 

davescm
Community Expert
Community Expert
December 17, 2020

Like this:

Type .jp2 here

 

 

The following screen will look like this:

 

 

 

Dave