
发布日期:2025-03-07 16:38 点击次数:122
图片
点击开始对话,进行注册登录。图片
用deepseek来抠图的原理:用deepseek帮助生成JSX格式的脚本文件,然后,在PS中加载并运行脚本。【基本操作方法】1.生成PS脚本打开deepseek,找到生成PS脚本的功能。输入想做的事情,例如:“请帮我写一个PS脚本,用于自动抠图。”可以提供更多细节来确保生成的脚本能处理细节,比如说明需要如何处理头发边缘、背景、色彩等。deepseek会自动分析需求,并推理出一个可行的解决方案。然后,它会给你生成相应的PS脚本代码。
图片
2.复制脚本,保存为jsx文件将deepseek生成的脚本复制到文本编辑器(例如记事本)中,保存为.jsx文件。jsx是photoshop可以识别的脚本。本质上是用JavaScript脚本实现。以下是deepseek生成的用于Photoshop自动抠图的JavaScript脚本,重点处理头发边缘细节。此脚本结合了'选择主体'和'选择并遮住'功能,适用于Photoshop CC 2018及以上版本:// 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();将上述脚本另存为jsx文件。图片
图片
3.在PS中运行脚本打开photoshop,加载图片,依次点击“文件”——“脚本”——“浏览”,找到刚才的jsx文件,点击打开,PS会自动运行脚本,开始自动抠图,AI生成的脚本非常专业,对细节的处理,比如边缘的处理,接近PS学习的比较好的人类。图片
4.运行效果图片
图片
注意:如果脚本运行错误,可能是PS版本的问题,需要对代码进行修改。总结:有了deepseek,很多PS的功能都可以实现自动化,比如照片调色、修复、抠图,以及其他批量处理等,可以帮助轻松完成繁琐的图片处理任务,提高效率。 本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报。