Script to open a file and zoom to pixel

Hi, I work for a mapping company and one of our digital camera has a fault with the lens resulting in a small black mark appearing in exactly he same location of every image we capture what I would like is a script that can be used to open a file set the zoom say to 100% and move to pixel 3324x5493 so I user can repair it.
I thought this would be simple but I've been looking all evening without finding anything
Thanks
Stu

I have something started but it isn't quite finished. It will center on the pixel and zoom in, but the only holdback is it increases the canvas size which will need to be cropped later. If you first set the Background layer to a non-Background layer your extra canvas will be transparent which will allow for a simple trim to return to the normal image later.
function centerON (x,y) {
    var startRulerUnits = app.preferences.rulerUnits;
    var startTypeUnits = app.preferences.typeUnits ;
    var startDisplayDialogs = app.displayDialogs;
    app.preferences.rulerUnits = Units.PIXELS;
    app.preferences.typeUnits = TypeUnits.PIXELS;
    app.displayDialogs = DialogModes.NO;
    var centerDoc=app.activeDocument;
    w=centerDoc.width.value;
    h=centerDoc.height.value;
    hdiff=Math.round(Math.abs((x-w/2)*2));
    vdiff=Math.round(Math.abs((y-h/2)*2));
    if (x>w/2) {var hor="LEFT";}
    else if (x<w/2) {var hor ="RIGHT";}
    else {var hor="CENTER";}
    if (y>h/2) {var ver="TOP"; }
    else if (y<h/2) {var ver="BOTTOM"; }
    else {var ver="MIDDLE"; }
    newwidth=w+hdiff;
    newheight=h+vdiff;
    switch (ver) {
        case "TOP":
        switch (hor) {
            case "LEFT": anchor=AnchorPosition.TOPLEFT; original=[0,0,w,h]; break;
            case "RIGHT": anchor=AnchorPosition.TOPRIGHT; original=[hdiff,0,hdiff+w,h]; break;
            case "CENTER": anchor=AnchorPosition.TOPCENTER; original=[0,0,w,h]; break;
        }; break;
        case "BOTTOM":
        switch (hor) {
            case "LEFT": anchor=AnchorPosition.BOTTOMLEFT; original=[0,vdiff,w,vdiff+h]; break;
            case "RIGHT": anchor=AnchorPosition.BOTTOMRIGHT; original=[hdiff,vdiff,hdiff+w,vdiff+h]; break;
            case "CENTER": anchor=AnchorPosition.BOTTOMCENTER; original=[0,vdiff,w,vdiff+h]; break;
        }; break;
        case "MIDDLE":
        switch (hor) {
            case "LEFT": anchor=AnchorPosition.MIDDLELEFT; original=[0,0,w,h]; break;
            case "RIGHT": anchor=AnchorPosition.MIDDLERIGHT; original=[vdiff,0,vdiff+w,h]; break;
            case "CENTER": anchor=AnchorPosition.MIDDLECENTER;original=[0,0,w,h]; break;
        }; break;
    app.runMenuItem(charIDToTypeID("FtOn"));
    centerDoc.resizeCanvas(newwidth,newheight,anchor);
    app.runMenuItem(charIDToTypeID("ActP"));
    app.refresh();
//    centerDoc.trim();
//    centerDoc.crop(original);
    app.preferences.rulerUnits = startRulerUnits;
    app.preferences.typeUnits = startTypeUnits;
    app.displayDialogs = startDisplayDialogs;
centerON(234,3500);
For centerON(234,3500); you would of course input your own x,y coordinates where you want to center the image.
The issue I'm having is that if I trim or crop the image, it will sometimes re-center the image elsewhere. I've tried using a crop with hide to center on the pixel then Reveal All to show the whole image again, but that also re-centers the image. Though, that may actually be a better way for you to do it afterall. Instead of increasing the canvas size, you could crop with hide to put the center on the pixel you want, then when finished just Reveal All.
It would just be easier if Photshop kept focus centered during a crop.

Similar Messages

  • Batch script to open multiple excel and doc files

    Hi Everyone,
    Could anybody please provide a batch script to open multiple excel and doc files at a time.
    Appreciate ur quick response.
    Regards,

    You have several scripting choices within Windows. At a basic level you've got "batch files" - which run a series of command interpreter commands, and have a file extension of .BAT or .CMD. If you just wanted to open a list of Word documents, then assuming that the path to Word is correct (something like this below) you could list these in a file with a .BAT extension and run this (e.g. double click on it):
    "C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File1.DOC"
    "C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File2.DOC"
    "C:\Program Files\Microsoft Office\Office\Winword.exe" "C:\Documents and Settings\All Users\Desktop\File3.DOC"
    "C:\Program Files\Microsoft Office\Office\Excel.exe" "C:\Documents and Settings\All Users\Desktop\File1.XLS"
    "C:\Program Files\Microsoft Office\Office\Excel.exe" "C:\Documents and Settings\All Users\Desktop\File2.XLS"
    Another script language is VBScript, which was the example I gave. VBScript is available on most Windows platforms and can be run from a command prompt or within Windows. If you save the text I gave you above to a file with a .VBS extension you can double-click to run it (Windows) or open a command prompt and type CSCRIPT MyVBScript.VBS (assuming that's the name of the your .VBS file).
    Other script languages are available to achieve the same thing, including Powershell, however you'd need to have Powershell available on your PC.

  • I have an older version of imovie.  After I change the photos using the Ken Burns effect and save them, the next time I open the file and click 'show photo settings' to change the zoom, the picture appears black and I can't change the zoom?

    I have a five year old version of imovie that generally works fine.  However, when I add a photo using the 'Ken Burns' effect then save the movie, the next time I open the file and click 'show photo settings' the picture appears black and I cannot change the zoom.  Any suggestions?

    Have you rendered both iOS 7 and iOS 8 (both of which will work on your iPhone 5) out of the question entirely without trying every possible configuration? The animations can be disabled entirely, if that's the problem. And if the whiter-brighter user interface is the problem, there's reverse-contrast modes that darken everything. You can expose accessibility controls to gain immediate access to these functions to toggle them on and off. I guess my point is you may have decided against upgrading the OS based on an early experience with iOS 7 when Apple has since made changes in later revisions to address some of the usability complaints.
    Now, Apple's instructions for downloading older versions of apps is to do so from the Purchased list, not from the app's product page.
    See here:
    Install the latest compatible version of an app on an earlier version of iOS or OS X - Apple Support
    Let us know how that works for you.

  • I want to open a file and have it fill the desktop - how??

    I have recently moved over from CS2 on PC to CS3 in MAC - I used to be able to open a file and it would open up in a full window filling the whole screen - now it opens up in a box with no surrounding space. When I maximize the minute I tap cmd + the widow reduces to minimize and just zooms into a part of the file. I am sure this is basic stuff but any help out there please??
    gratefully
    Angus

    That's the difference between Macs and Windows. Windows opens applications in a... Window.
    Try hitting the F key and see if that works for you.

  • How open a file and not showing window?

    I write a script to do some work automatic,
    for Indesign script, its application open method could open a file and not showing window,
    the open method has a parameter [ShowingWindow] (if true, show the document window).
    That is good a feature for me.
    But with Illustrator, the application open method hasn't the same feature.
    Open
    (files as String,
    [documentColorSpace as AiDocumentColorSpace],
    [options as Object])
    and for OpenOptions properties, there is not useful information for me.
    Is there any other methods could do that?
    Any help is greatly appreciated.

    Thank for your reply.

  • System exec, How I say to open one file and make operation in external program?

    Hi,
    I got called an external program with the system exec.vi, but i would like the program open the file saved in the other window, i can get the file path, but how Can I put the file path in the external program and the program open the file and I tell (in this case compile), since i open one file code c and only i must to open and say to the program 'compile' and then close external program.
    Any help?. Thanks.
    Attachments:
    system_exec.GIF ‏8 KB

    Hi Fonsi,
    System Exec.vi will allow you to run commands like launching a program easily but it is difficult and many times not possible to execute commands within an application.
    A better way maybe to approach this though ActiveX. Please look at the following example that uses ActiveX to communicate with Excel.
    Writing Rows to Excel 97 and Excel 2000 Using ActiveX
    If you are not familiar to ActiveX and LabVIEW, please read the document below:
    ActiveX and LabVIEW
    I hope this
    helps.
    Sincerely,
    Feroz
    National Instruments

  • Because I can no longer open Adobe files, and have tried all obvious solutions, I've been told to defrag the Intel portion of my MacBook Pro. How do I do this?

    Because I can no longer open Adobe files, and have tried all obvious solutions, I've been told to defrag the Intel portion of my MacBook Pro. How do I do this?
    I never use the Intel side, and have never partitioned the MacBook Pro.
    Message was edited by: MacGirl221b

    I never use the Intel side,
    Not understood, Intel make the processor that runs your Mac, there is no other 'side' to your Mac.
    What Adobe application are you trying to open files with?

  • Can not open JPEG files and can not create JPEG files from other software

    Can not open JPEG files and can not create JPEG files from other software (For example from Solidworks).
    When I try to right click on a JPEG, a notice window appears written: "Windows Explorer has stopped working - Windows is
    checking for a solution to the problem" and then the notice box disapears, the desktop appears and I can continue working.
    From the other side - If I try to save as JPEG a screen of Solidworks (like a view of a part) the Solidworks falls but the JPEG
    is created (I can see its name in the directory I created it).
    I can open the JPEGS with the Paint software if I want but not with the Windows Photo Viewer.
    I have the feeling that the Windows Photo Viewer disapeared from my computer - just a feeling.
    I will appreciate your assistance.
    Avi T. 2014

    Hi,
    Did Windows Photo Viewer option appear when you right click the JPEG file and select open with?
    I would like suggest you use Clean Boot to troubleshoot if there is third-party software conflict:
    How to perform a clean boot in Windows
    http://support.microsoft.com/kb/929135
    Karen Hu
    TechNet Community Support

  • I am trying to open my files and I get the message that the file is invalid.  The index sml file is missing

    I am trying to open my files and get a message saying that the file is invalid.  The index xml file is missong

    Tell us the whole Story in detail about what App (if any), version, any changes you have made recently and Importantly, the exact message - verbatim - a screenshot of the entire display would be very helpful - ÇÇÇ

  • I downloaded ITunes and now I tried to open the file, and it is not supporting the file

    I downloaded ITunes on my galaxy s4 and tried to open the file and it says it is not supported

    Errr, this is a Adobe Lightroom user to user forum, do you have a question about Lightroom?

  • Someone help! i went to open a file and the "initializing" box froze

    ok. heres my deal. i recorded something w/ a friend one day and we opened the file and did whatever with it and it was fine. we would even come back later and open the file again and it still worked great. the next day however, i went to open the same file to record/edit more with it and it simply would not open. no error message or anything. the "initializing" box just sat there forever. is it corrupted? and if so how can i fix it?? pleeease help!

    <sigh> Wish I could tell you the "why", not being there myself it's impossible, and even if I were, it's hard to say if even then I'd know.
    The bigger "sigh" is that the last resort was to try opening the package and dropping the raw files into a new project, but if they're not there at all, then there really isn't anything to do, the files are gone B-(>
    The only advice I can offer at this point is some for the future: If you have a one of a kind take, never work with the original, and at that always make a copy and put it somewhere else (another computer, another hard drive, and/or a CD/DVD.
    Sorry I don't have better news, Kurtis --Hang %-(>

  • I cant set my ps cc 2014 as a default program to open psd files and alike. What will I do?

    I cant set my ps cc 2014 as a default program to open psd files and alike. What will I do?

    What will I do?
    You could try giving pertinent information. (edited)
    http://forums.adobe.com/docs/DOC-2325

  • How to open .rar files and .exe files on mac

    HI
    I'm new user on mac and would like to know how to open .rar files and .exe files on MAC OS X
    Thanks

    How is this a Compressor question?
    .exe is a Windows only Executable, and can't be opened on a Mac, unless you have Windows installed.
    Michael Trauffer

  • Photoshop shut down while I drew a picture, now the file is broken and I can´t fix it, photshop won´t open the file and I have tried repearing it with different programs. What should I do?

    Photoshop shut down while I drew a picture, now the file is broken and I can´t fix it, photshop won´t open the file and I have tried repearing it with different programs. What should I do? I spent 6 hours on the pic and I dont even have a screenshot or anything.

    You don't even say what platform you are on, or any other details that may help others assist you.
    If you are on a Mac, try opening your file in GraphicConverter (they have a demo version) if that doesn't open it, nothing will, in my experience.
    I assume you have tried Adobe Illustrator already to recover.
    You may also have a JPEG of your complete file (flattened) in Bridge Cache.
    On the Mac you'd find it in your User ~Library (NOT the Root Library ):
    Users > yourname > Library > Caches > Adobe > Bridge CS6 > Cache > 1024 > jpg(fileID)number Filename.psd.jpg
    The user ~Library is hidden, but you can make it visible for an moment or two.  Ask Apple if you don't know how.
    I don't do Windows.

  • I have not been able to open PDF Files and i get a message saying Missing Plug-ins

    I have not been able to open PDF Files and i get a message saying Missing Plug-ins

    The message may be refering to Adobe plug-ins. To use Apple Preview to view PDF, right click on any PDF you have/Get Info. In the Info Window/Open with: Select Preview > Select Change All

Maybe you are looking for

  • IMac/iTunes to Hi-Fi

    Does anyone have suggestions for connecting my (non-Airport) iMac to my Hi-Fi system so that I can play music from iTunes, other than using Airport Express. Has anyone used Xitel products with their iMac?

  • T. Code to create the GR / GI Material Document No. Ranhe

    Hi,   I want to know the T. code and step  how to create new material document for GI and Gi  accounting doc. i know with T. Code  OMBA and OBF4 i want how to create goods movemen tdoc. no. regards, zafar

  • Canon 7D Mark II fails to connect with LR 5.7 for tethered shoot.

    Canon 7D2 fails to connect with LR 5.7 for tethered shoot.   The camera connection does work with Canon EOS Utility. LR sees the camera but fails to establish and maintain connection.  See small video clip to view the camera and computer behaviour wh

  • Raptivity using MFO in Adobe Captivate 4

    Hello,   I have created a interactivity file with Raptivity that I would like to embed in my Adobe Captivate project.  Usually I publish with a SFO (I remember reading somewhere that it is better to publish interactivities for Adobe with SFO)  but th

  • Advice on SAP HR

    Hi, I am Rajasekar having 6 years of HR domain experience and plan to pursue SAP HR program. Kindly let me your advice on this and the insitutes in Bangalore please let me know. Regards, Rajasekar