


打开deepseek,找到生成PS脚本的功能。输入想做的事情,例如:“请帮我写一个PS脚本,用于自动抠图。”可以提供更多细节来确保生成的脚本能处理细节,比如说明需要如何处理头发边缘、背景、色彩等。deepseek会自动分析需求,并推理出一个可行的解决方案。然后,它会给你生成相应的PS脚本代码。

// Photoshop自动抠图脚本 with 毛发细节处理// 建议在Photoshop CC 2019+ 版本运行var autoCutout = {// 参数配置区(用户可调整)settings: {smartRadius: true, // 启用智能半径radius: 5, // 半径像素值 (1-500)smoothness: 5, // 平滑度 (0-100)feather: 0.5, // 羽化 (0-10)contrast: 15, // 对比度 (0-100)shiftEdge: -10, // 移动边缘 (-100-100)outputType: "Layer Mask" // 输出类型: "Layer Mask" 或 "New Layer"},execute: function() {var doc = app.activeDocument;var layer = doc.activeLayer;try {// 第一步:创建基础选区app.runMenuItem(stringIDToTypeID("AutoCutout"));// 第二步:进入"选择并遮住"工作区var descriptor = new ActionDescriptor();descriptor.putEnumerated(stringIDToTypeID("preset"), stringIDToTypeID("selectionPresetType"), stringIDToTypeID("selectionPresetDefault"));// 设置边缘调整参数var edgeAdjustment = new ActionDescriptor();edgeAdjustment.putBoolean(stringIDToTypeID("smartRadius"), this.settings.smartRadius);edgeAdjustment.putUnitDouble(stringIDToTypeID("radius"), stringIDToTypeID("pixelsUnit"), this.settings.radius);edgeAdjustment.putUnitDouble(stringIDToTypeID("smoothness"), stringIDToTypeID("percentUnit"), this.settings.smoothness);edgeAdjustment.putUnitDouble(stringIDToTypeID("feather"), stringIDToTypeID("pixelsUnit"), this.settings.feather);edgeAdjustment.putUnitDouble(stringIDToTypeID("contrast"), stringIDToTypeID("percentUnit"), this.settings.contrast);edgeAdjustment.putUnitDouble(stringIDToTypeID("shiftEdge"), stringIDToTypeID("percentUnit"), this.settings.shiftEdge);descriptor.putObject(stringIDToTypeID("edgeAdjustment"), stringIDToTypeID("edgeAdjustment"), edgeAdjustment);// 设置输出选项var outputSettings = new ActionDescriptor();outputSettings.putEnumerated(stringIDToTypeID("output"), stringIDToTypeID("outputTo"), stringIDToTypeID("selection"));descriptor.putObject(stringIDToTypeID("outputSettings"), stringIDToTypeID("outputSettings"), outputSettings);executeAction(stringIDToTypeID("selectionToWorkpath"), descriptor, DialogModes.NO);// 第三步:创建蒙版if (this.settings.outputType === "Layer Mask") {layer.layerMaskEnabled = true;} else {layer.copy();doc.paste();doc.activeLayer.name = "抠图结果";}// 清除选区doc.selection.deselect();} catch(e) {alert("执行错误: " + e.message);}}};// 执行脚本autoCutout.execute();



![]() | ![]() |