- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个脚本试图:
- scan an InDesign document for all images
- send all images to Photoshop via the
BridgeTalk
object- resize all of the images to 600px width (maintaining aspect-ratio mathematically)
- export all of the images from Photoshop to a new folder
General Photoshop error occurred. This functionality may not be available in this version of Photoshop.
Error in Line 1:
Could not complete the command because the scratch disks are full.
function resaveInPS(imagePaths, imagesFolder)
{
/*
* NOTE: no single-line comments are allowed in this function, because it is not read line-by-line by BridgeTalk, but as a single String;
* only multi-line comments will work, because they are terminated at each end
*/
BridgeTalk.bringToFront("photoshop"); /* switch view from InDesign to Photoshop */
app.displayDialogs = DialogModes.NO; /* Photoshop statement, prevents status alerts from interrupting */
var imagePath = "";
var fileName = "";
var largerImage = "";
for(var i = 0; i < imagePaths.length; i++)
{
imagePath = imagePaths[i].fullName;
fileName = imagePaths[i].name;
largerImage = fileName.substr(0, fileName.length - 4); /* getting rid of the file extension: Photoshop will handle the file extension */
var photoshopDoc = "";
photoshopDoc = app.open(new File(imagePath) );
var currentWidth = photoshopDoc.width; /* in inches */
var currentHeight = photoshopDoc.height; /* in inches */
currentWidth.convert("px"); /* now in pixels */
currentHeight.convert("px"); /* now in pixels */
var newWidth = 600; /* defining the desired exported image width here */
var ratio = newWidth / currentWidth;
var newHeight = ratio * currentHeight; /* maintaining aspect ratio of the resized image's height here */
alert("The currentHeight is " + currentHeight + ".\n\nThe ratio is " + ratio + ".\n\nThe newHeight is " + newHeight + ".");
photoshopDoc.resizeImage(newHeight, newWidth); /* (height, width) */
photoshopDoc.resizeCanvas(newHeight, newWidth); /* (height, width) */
var saveOptions = new TiffSaveOptions(); /* handling the file extension here */
photoshopDoc.saveAs(new File(imagesFolder + "/" + largerImage), saveOptions); /* saving the new image in the folder here, with the file extension */
photoshopDoc.close(SaveOptions.DONOTSAVECHANGES); /* close the Photoshop document without saving */
app.purge(PurgeTarget.ALLCACHES); /* clears the clipboard, history, and undo cache in Photoshop; Note: does NOT delete the temporary files! */
} /* end of for loop */
app.displayDialogs = DialogModes.ALL; /* resume normal dialogs after saving the file and closing the document */
app.purge(PurgeTarget.ALLCACHES); /* clears the clipboard, history and undo cache in Photoshop; Note: does NOT delete the temporary files! */
} // end of function ResaveInPS
app.purge(PurgeTarget.ALLCACHES)
似乎没有太大影响,因为错误仍在发生......
最佳答案
所以,我错误地假设类型强制将适用于单位值,但当然它不会因为“像素”不是默认的 Javascript 类型。
不申请 new UnitValue
至 var ratio
, ratio 被强制输入 Number
(虽然 | currentWidth
是 用“像素”单元类型实例化)。此外,var newWidth
仍然是一个类型 Number
因为它是。
这是更正后的代码,从 var currentWidth
行开始并以 | resizeCanvas
结尾:
var currentWidth = photoshopDoc.width; /* in inches */
var currentHeight = photoshopDoc.height; /* in inches */
currentWidth.convert("px"); /* now in pixels */
currentHeight.convert("px"); /* now in pixels */
var newWidth = new UnitValue(600, "px"); /* defining the desired exported image width here */
var ratio = new UnitValue(newWidth / currentWidth, "px");
var newHeight = new UnitValue(ratio * currentHeight, "px"); /* maintaining aspect ratio of the resized image's height here */
/*alert("The currentHeight is " + currentHeight + ".\n\nThe ratio is " + ratio + ".\n\nThe newHeight is " + newHeight + ".");*/
photoshopDoc.resizeImage(newWidth, newHeight); /* (width, height) */
photoshopDoc.resizeCanvas(newWidth, newHeight); /* (width, height) */
resizeImage
和
resizeCanvas
向后!这是两者的正确顺序:
(width, height)
.
关于image-processing - Photoshop/InDesign CS5 脚本 : image size conversion error is using too much memory?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11478651/
有没有人有嵌套 Intent 的好例子,尤其是在 #yes 和 #no 是子节点的情况下。我得到的情况是 API 返回的是 Intent 值,但输出文本来自“Anything else”! 最佳答案
我知道您可以转到 Watson Conversation 界面,右键单击工作区,然后下载工作区的 JSON,其中包含意图,如下所示:Is there any way to export intents
我能否在 Watson Conversation API 的对话流中使用节点条件中的意图置信度评级? 最佳答案 要做到这一点,请创建一个条件来寻找您的意图,然后检查置信度。 你会拥有的示例条件 #te
我找到了很多关于这个错误的帖子,但我可以找到克服它的方法。这是触发错误的代码: void main(){ float f{1.3}; } 为什么在初始化列表中没有像其他变量那样发生转换?例如,
我有以下代码。 #include using namespace std; class Base { public: virtual int f(){coutf(); ///base
Visual C++ 2017 和 gcc 5.4 产生 conversion from 'const unsigned char' to 'const float' requires a narro
我正在为 PIC18F2420 使用带有 xc8 1.35 编译器的 MPLABX 3.20,我收到了两个我不理解的奇怪警告: 这是生成警告的源代码之一 9 void write(Pin _Pin,
我正在尝试在 win32 API(无 mfc)上编写一些直接的 c++。有了这个更现代的 c++ 编译器,我得到: 警告 C4838:从“unsigned int”到“int”的转换需要收缩转换 它发
此代码采用用户输入(字符 C、T、B)和(int 0-24 和 0-60)来计算 parking 成本关于用户输入的车辆类型。 我怀疑错误发生在函数 charged 中,因此我无法在收到此错误的最后一
为什么在使用 tuple 或 Tuple 转换向量时会得到以下不同的结果? julia> a = [1, 2, 3] 3-element Vector{Int64}: 1 2 3 julia> tup
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 8年前关闭。 Improve t
我正在开发一个文件共享网站,我需要一种方法来对上传的文档进行截图。 该站点将支持多种文件格式,从纯文本到办公文档(doc、xls、ppt...)、视频(mpeg、avi...)、图像(jpg、gif、
在 VHDL 中是否有将整数类型对象转换为实数类型的通用转换函数? 这是针对测试平台的,因此可综合性不是问题。 最佳答案 您可以将整数转换为实数,如下所示: signal i: integer; si
如何在 Ocaml 中将字符串选项数据类型转换为字符串? let function1 data = match data with None -> "" | Some str -> s
我已经在 VHDL 中编写了一个算法,但是我有一条消息,我不明白“sra/sla 在这种情况下不能有这样的操作数。”。请问有什么帮助吗? library ieee; use ieee.std_logi
我经常需要将数据从一种类型转换为另一种类型,然后进行比较。一些运算符会先转换为特定类型,这种转换可能会导致效率损失。例如,我可能有 my $a, $b = 0, "foo"; # initial va
假设我在 IBM Watson 中配置了一个对话服务,可以识别以单词和片段形式给出的数字。例如,如果我有号码 1320 , 可以发送为 thirteen twenty或 thirteen two ze
也许我错过了一些显而易见的事情...在整个文档中,我似乎都认为Kotlin具有各种类型的序列,这些序列不能互操作。即使复制序列可能效率不高–当我需要将其作为语义相同但不同的类型传递给函数时,这也无济于
在我的Linux终端中,我想要使用QTcpSocket从qt运行以下“对话”: S user@domain:~ $ netcat 1.1.1.2 9230 R HELO SOME MORE I
我有一个模板函数,其中枚举类型转换为它的底层类型,工作正常,但我写了一个重载,它应该接受一个整数并返回它自己,它给我一个错误,指出 int 不是枚举类型。在我的模板中,这应该已经被过滤掉了。怎么了?
我是一名优秀的程序员,十分优秀!