photoshop - 以多种 jpeg 质量或文件格式同时导出文件

问题描述

在 photoshop 中,我需要以 100% 和 10% 的比例导出文件。有没有一种简单的方法可以一次性完成,而不必执行两次?谢谢

解决方法

假设您在谈论 jpeg 质量。

稍加挖掘,您就可以找到一个 function to save as an image as jpg

// Path to the two images,named appropriately
// NOTE change to suit your needs
var myFileA = "C:\\myfolder\\myjpeg_high_quality.jpg";
var myFileB = "C:\\myfolder\\myjpeg_low_quality.jpg";

// Jpeg quality used to be from 1-10 in the old days.
// Now it's from 1-12,Let's save out the best and the worst.
jpeg_it(myFileA,12);
jpeg_it(myFileB,1);


// function JPEG IT (file path + file name,quality)
// ----------------------------------------------------------------
function jpeg_it(filePath,jpgQuality)
{
  if(! jpgQuality) jpgQuality = 12;

  // jpg file options
  var jpgFile = new File(filePath);
  jpgSaveOptions = new JPEGSaveOptions();
  jpgSaveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
  jpgSaveOptions.embedColorProfile = true;
  jpgSaveOptions.matte = MatteType.NONE;
  jpgSaveOptions.quality = jpgQuality;

  activeDocument.saveAs(jpgFile,jpgSaveOptions,true,Extension.LOWERCASE);
}