Click here to Skip to main content
15,886,840 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 31-Aug-12 1:11am
v2
Comments
BillWoodruff 20-Sep-13 6:55am    
How's it going in trying to get this to work ?

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!
 
Share this answer
 
Comments
Dholakiya Ankit 20-Sep-13 0:33am    
good link :) mine 5+
BillWoodruff 20-Sep-13 5:30am    
Hi OG, I'm curious: have you ever tried controlling PhotoShop from .NET yourself; it's not that difficult using Adobe's Interop.PhotoShop.dll. I have to translate the VB examples from Adobe's documentation into C#, but it's quite doable.

Looking at the OP here, I think the question has changed since it was first asked ?
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);
    }
}
 
Share this answer
 
v3
Comments
Christian Amado 31-Aug-12 11:42am    
+5! :)
Mas11 20-Sep-13 0:16am    
My Vote of 5*.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900