从C#程序在photoshop中打开图像 [英] open an image in photoshop from C# program

查看:403
本文介绍了从C#程序在photoshop中打开图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家好



i希望在c#中制作一个程序当我选择一个在photoshop中打开它的图像时我可以将任何参数传递给它放大spicified position ...请帮助

hi every body

i want to made a program in c# the when i select an image it open it in photoshop and i can pass any parameter to it like make a zoom in spicified position ... please help

推荐答案

开始阅读的时间! http://lonerobot.net/?p=374 [ ^ ]



在Photoshop中打开文件非常简单 - 只需使用Process 。启动适当的参数。但除此之外,还有一个COM互操作世界,你将不得不掌握......祝你好运!
Time to start reading! http://lonerobot.net/?p=374[^]

Opening the file in Photoshop is pretty easy - just use Process.Start with the appropriate parameters. But beyond that is a world of COM interop that you are going to have to master...Good Luck!


我首先尝试回答这个问题:可以PhotoShop是使用特定文件名启动的命令行(或在.NET中由Process.Start启动),以及在启动文件后可能影响任何视图的任何参数 :我是从这里开始:[ ^ ]:这个搜索仅限于去年。



在我看来,通过扫描上面搜索返回的标题,有一些提示p在JavaScript中提供帮助,但我没有尝试过,也不打算这样做。注意事项。



然后,也许,去Adobe的网站,下载他们的api文档,脚本文档和SDK,无论你使用什么版本的PhotoShop。有关Adobe的资源以及Adobe以外的PhotoShop脚本论坛,请参阅:[ ^ ]。



我扩展了一个JavaScript程序,最初由Filip Van Tendeloo编写[ ^ ] ,然后我每次在PhotoShop中加载任何文档时自动执行。



脚本自动创建指南。它包括列高度和行,宽度的交互式输入对话框。



当PS打开文档时,您可能希望使用该功能自动运行脚本。你编写一个.jsx文件然后存储,例如,在我的机器上为CS 6存储:



> C:\Program Files \Adobe \ Adob​​e Photoshop CS6(64位)\ Presets \Scripts\Event Scripts Only



代码,用于脚本我提到:
I'd first try to answer this question: can PhotoShop be command line (or in .NET by Process.Start) launched with a specific file name, and any parameters that might affect the "whatever" view after the file is launched: I'd start here: [^] : this search was limited to the last year.

It seems to me, from scanning the titles returned from the above search, there's some hint of passing in JavaScript, but I haven't tried this, and don't intend to. Caveat emptor.

Then, maybe, go to Adobe's website, and download their api docs, scripting docs, and SDK, for whatever version of PhotoShop you are using. For resources from Adobe, and a forum for PhotoShop scripting outside Adobe see: [^].

I have extended a JavaScript program, originally written by Filip Van Tendeloo[^], outside of PS CS 6, that I then have made execute automatically every time any document is loaded in PhotoShop.

The script creates guidelines automatically. It includes interactive input dialogs for column heights, and row, widths.

You may want to use that ability to run a script automatically when PS opens a document. You write a .jsx file which is then stored, for CS 6, for example, on my machine, in :

>C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts\Event Scripts Only

The code, for the script I mentioned:
// check for document has length
if(app.documents.length > 0)
{
    // original code by Filip Van Tendeloo
    // as cited in the article at:
    // http://coding.smashingmagazine.com/2012/04/11/css-sprites-revisited/

    // get active document
    var psDoc = app.activeDocument;

    // get user input on column count
    var colWidth = parseFloat( prompt("Column size?", 60.0) );
    var docWidth = psDoc.width;
    // determine number of columns
    var colCount = docWidth / colWidth;

    // create vertical guidelines
    for(i = 0; i < colCount; ++i)
    {
        psDoc.guides.add(Direction.VERTICAL, i * colWidth);
    }

    // extensions to Filip Van Tendelo's original script by Bill Woodruff:

    // get user input on row count
    var rowHeight  = parseFloat( prompt("Row size?", 60.0) );
    var docHeight = psDoc.height;
    // determine number of rows
    var rowCount = docHeight / rowHeight;

    // create rows
    for(i = 0; i < rowCount; ++i)
    {
        psDoc.guides.add(Direction.HORIZONTAL, i * rowHeight);
    }
}


这篇关于从C#程序在photoshop中打开图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆