Script That Crops Then Saves and Repeats?

Hello,
I am currently new to the scripting on Photoshop. Recently I have started to perform some very repetitive actions and was looking for alternatives to get them done. I looked around the internet for a certain script, but cannot find it. The scripts function would be the following...
Have a set pixel ratio (2048x2048)
Start in one of the corners
Crop the image (Mine is currently a little more than 20,000x20,000 pixels) down to the pixel ratio
Save that portion of the cropped image in png
Move left or right or down (whichever is logically next)
Repeat the process until the whole file has been saved in smaller chunks
If anyone knows if this script exists please point me to the correct resource, this would help me so, so, so much.
For anyone who is curious, here is the reason why I need a script that does this.
Currently I am working on the starting stages of a very large platformer game. Currently art seems to be the most heavy task on the game. The platforming world is going to be very large and hopeful everything will be unique (as in no repeating patterns or textures). There will be two artist working on the game, myself included. I was trying to find a more efficient way of saving these very large scale files in chunks. My current file or test file is around 20,000x20,000 pixels. Doing the math to save one layer of this image in 2048 block images will take 100 repetitive save motions. Take this number times 3 for the amount of layers I need saved and it jumps up to 300. In the end the game will be somewhere around 20,000x100,000 pixels, which will just kill me if I have to do it by hand. It would take days.
I have tried using slicing and the save for web option, but Photoshop cannot handle the large file. If there are any other methods that I can use to save a Photoshop image in 2048x2048 chunks easily, please let me know. This is a sort of make it or break it deal for the games art on whether we can make it more unique or have to use a lot of repeating patterns.

20.000 is not the product of a multiplication of 2048 and an integer.
I can’t remember having come across any Script that fits your needs perfectly.
If no one else can point to one and as the task is a somewhat specific one I wonder if you should try hiring someone to do it for you (if you should not be able to accomplish it yourself).
ps-scripts.com • Index page
Edit:
Does this help? (You’d need to amend the line
if (app.documents.length > 0) {main(300, 400)};
naturally.)
// make crops of an image according to a specific size;
// 2014, use at your own risk;
#target "photoshop-70.032"
if (app.documents.length > 0) {main(300, 400)};
////// function //////
function main (width, height) {
// set to pixels and 72ppi;
var myDocument = app.activeDocument;
var docName = myDocument.name;
var basename = docName.match(/(.*)\.[^\.]+$/)[1];
var docPath = myDocument.path;
// change to 72ppi;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var originalResolution = myDocument.resolution;
myDocument.resizeImage (null, null, 72, ResampleMethod.NONE);
var theState = myDocument.activeHistoryState;
var theCounter = 0;
var theVert0 = 0;
for (var n = 0; n < Math.ceil (myDocument.height / height); n++) {
theVert0 = height * n;
var theVert1 = theVert0 + height;
var theHor0 = 0;
for (var m = 0; m < Math.ceil (myDocument.width / width); m++) {
theHor0 = width * m;
var theHor1 = theHor0 + width;
// crop and save copy;
cropThis(theVert0, theHor0, theVert1, theHor1);
saveCopyAsTif (myDocument, docPath+"/"+docName+"_"+bufferNumberWithZeros (theCounter,3)+"_hor"+bufferNumberWithZeros (m, 3)+"_ver"+bufferNumberWithZeros (n, 3)+".tif");
myDocument.activeHistoryState = theState;
theCounter++;
// reset;
app.preferences.rulerUnits = originalRulerUnits;
myDocument.resizeImage (null, null, originalResolution, ResampleMethod.NONE);
////// crop //////
function cropThis (x1, x2, x3, x4) {
// =======================================================
var idCrop = charIDToTypeID( "Crop" );
    var desc7 = new ActionDescriptor();
    var idT = charIDToTypeID( "T   " );
        var desc8 = new ActionDescriptor();
        var idTop = charIDToTypeID( "Top " );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc8.putUnitDouble( idTop, idRlt, x1 );
        var idLeft = charIDToTypeID( "Left" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc8.putUnitDouble( idLeft, idRlt, x2 );
        var idBtom = charIDToTypeID( "Btom" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc8.putUnitDouble( idBtom, idRlt, x3 );
        var idRght = charIDToTypeID( "Rght" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc8.putUnitDouble( idRght, idRlt, x4 );
    var idRctn = charIDToTypeID( "Rctn" );
    desc7.putObject( idT, idRctn, desc8 );
    var idAngl = charIDToTypeID( "Angl" );
    var idAng = charIDToTypeID( "#Ang" );
    desc7.putUnitDouble( idAngl, idAng, 0.000000 );
    var idDlt = charIDToTypeID( "Dlt " );
    desc7.putBoolean( idDlt, false );
    var idcropAspectRatioModeKey = stringIDToTypeID( "cropAspectRatioModeKey" );
    var idcropAspectRatioModeClass = stringIDToTypeID( "cropAspectRatioModeClass" );
    var idtargetSize = stringIDToTypeID( "targetSize" );
    desc7.putEnumerated( idcropAspectRatioModeKey, idcropAspectRatioModeClass, idtargetSize );
executeAction( idCrop, desc7, DialogModes.NO );
////// save pdf //////
function saveCopyAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, true);
////// buffer number with zeros //////
function bufferNumberWithZeros (number, places) {
  var theNumberString = String(number);
  for (var o = 0; o < (places - String(number).length); o++) {
  theNumberString = String("0" + theNumberString)
  return theNumberString

Similar Messages

  • Script that enables mail users and kicks out two csv files

    I am working on a script that will mainly be used as a scheduled task to enabled mailuser by calling the update-recipient command. 
    But before it calls that command it will get for various issues that can cause errors.
    Missing PrimarySMTP
    Display name having a space at front or back.
    The external email address being blank.
    I have IF statements setup to check for those and then call a function that will save into an array the issue for that user. 
    Here is the script
    <#
    .SYNOPSIS
    Enable-MailUsers Synced Mail Users in the Exchange environment
    THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE
    RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE USER.
    Version .9, 30 June 2014
    .DESCRIPTION
    This script mail-enables Synced Mail Users and creates a CSV report of mail users that were enabled.
    The following is shown:
    * Report Generation Time
    .PARAMETER SendMail
    Send Mail after completion. Set to $True to enable. If enabled, -MailFrom, -MailTo, -MailServer are mandatory
    .PARAMETER MailFrom
    Email address to send from. Passed directly to Send-MailMessage as -From
    .PARAMETER MailTo
    Email address to send to. Passed directly to Send-MailMessage as -To
    .PARAMETER MailServer
    SMTP Mail server to attempt to send through. Passed directly to Send-MailMessage as -SmtpServer
    .PARAMETER ScheduleAs
    Attempt to schedule the command just executed for 10PM nightly. Specify the username here, schtasks (under the hood) will ask for a password later.
    .EXAMPLE
    Generate the HTML report
    .\Enable-MailUsers.ps1 -SendMail -MailFrom [email protected] -MailTo [email protected] -MailServer ex1.contoso.com -ScheduleAs SvcAccount
    #>
    param(
    [parameter(Position=0,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Send Mail ($True/$False)')][bool]$SendMail=$false,
    [parameter(Position=1,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail From')][string]$MailFrom,
    [parameter(Position=2,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail To')]$MailTo,
    [parameter(Position=3,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Mail Server')][string]$MailServer,
    [parameter(Position=4,Mandatory=$false,ValueFromPipeline=$false,HelpMessage='Schedule as user')][string]$ScheduleAs
    # Sub Function to neatly update progress
    function _UpProg1
    param($PercentComplete,$Status,$Stage)
    $TotalStages=5
    Write-Progress -id 1 -activity "Mail enabled Objects" -status $Status -percentComplete (($PercentComplete/$TotalStages)+(1/$TotalStages*$Stage*100))
    #Sub Function create ErrObject output
    function _ErrObject{
    Param($name,
    $errStatus
    If(!$err){
    Write-Host "error detected"
    $script:err = $True
    $ErrObject = New-Object -TypeName PSObject
    $Errobject | Add-Member -Name 'Name' -MemberType Noteproperty -Value $Name
    $Errobject | Add-Member -Name 'Comment' -MemberType Noteproperty -Value $errStatus
    $script:ErrOutput += $ErrObject
    # 1. Initial Startup
    # 1.0 Check Powershell Version
    if ((Get-Host).Version.Major -eq 1)
    throw "Powershell Version 1 not supported";
    # 1.1 Check Exchange Management Shell, attempt to load
    if (!(Get-Command Get-ExchangeServer -ErrorAction SilentlyContinue))
    if (Test-Path "D:\Exchsrvr\bin\RemoteExchange.ps1")
    . 'D:\Exchsrvr\bin\RemoteExchange.ps1'
    Connect-ExchangeServer -auto
    } elseif (Test-Path "D:\Exchsrvr\bin\Exchange.ps1") {
    Add-PSSnapIn Microsoft.Exchange.Management.PowerShell.Admin
    .'D:\Exchsrvr\bin\Exchange.ps1'
    } else {
    throw "Exchange Management Shell cannot be loaded"
    # 1.2 Check if -SendMail parameter set and if so check -MailFrom, -MailTo and -MailServer are set
    if ($SendMail)
    if (!$MailFrom -or !$MailTo -or !$MailServer)
    throw "If -SendMail specified, you must also specify -MailFrom, -MailTo and -MailServer"
    # 1.3 Check Exchange Management Shell Version
    if ((Get-PSSnapin -Name Microsoft.Exchange.Management.PowerShell.Admin -ErrorAction SilentlyContinue))
    $E2010 = $false;
    if (Get-ExchangeServer | Where {$_.AdminDisplayVersion.Major -gt 14})
    Write-Warning "Exchange 2010 or higher detected. You'll get better results if you run this script from an Exchange 2010/2013 management shell"
    }else{
    $E2010 = $true
    $localserver = get-exchangeserver $Env:computername
    $localversion = $localserver.admindisplayversion.major
    if ($localversion -eq 15) { $E2013 = $true }
    #Get date
    $filedate = get-date -uformat "%m-%d-%Y"
    $filedate = $filedate.ToString().Replace("0", "")
    #Get the valid users that are not mail-enabled
    _UpProg1 1 "Getting User List" 1
    #$Users = Get-mailuser -ResultSize unlimited -OrganizationalUnit "R0018.COLLABORATION.ECS.HP.COM/Accounts/AbbVienet/Users" | ?{$_.legacyexchangeDN -eq ""}
    $i = 0
    $output = @()
    $errOutput = @()
    $err = $False
    #2 Process users
    ForEach ($User in $Users){
    $i++
    _UpProg1 ($i/$Users.Count*100) "Updating Recipients" 2
    If ($user.ExternalEmailAddress -eq $null){
    _ErrObject $user.Name, "Missing External Email Address"
    ElseIf($user.DisplayName -NotLike "* "){
    _ErrObject $user.Name, "DisplayName contains a trailing space"
    ElseIf($user.DisplayName -NotLike "_*"){
    _ErrObject $user.Name, "DisplayName contains a Leading space"
    ElseIf($user.PrimarySmtpAddress -eq $null){
    _ErrObject $user.Name, "Missing Primary SMTP address"
    Else{
    #Disable EmailAddressPolicy on these users
    Set-Mailuser $User.Name -EmailAddressPolicyEnabled $false
    #pass to Update-recipient
    Update-Recipient $User.Name
    $LEDN = Get-MailUser $User.Name | Select {$_.LegacyExchangeDN}
    If ($LEDN -ne ""){
    $object = New-Object -TypeName PSObject
    $X500 = "x500:" + $LEDN.'$_.LegacyExchangeDN'
    $object | Add-Member -Name 'Name' -MemberType Noteproperty -Value $User.Name
    $object | Add-Member -Name 'x500' -MemberType Noteproperty -Value $X500
    $output += $object
    #Creating CSVFile Output
    _UpProg1 99 "Outputting CSV file 3" 3
    $CSVFile = "c:\scripts\Mail-enable\Mailenabled_$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).csv"
    If($err){
    $ErrCSVFile = "c:\scripts\Mail-enable\ProblemUsers_$((Get-Date).ToString('MM-dd-yyyy_hh-mm-ss')).csv"
    $errOutput | Select-Object Name, Comment | ConvertTo-CSV -NoTypeInformation > $ErrCSVFIle
    $Output | ConvertTo-Csv -NoTypeInformation > $CSVFile
    if ($SendMail)
    _UpProg1 95 "Sending mail message.." 4
    If($err){
    Send-MailMessage -Attachments $CSVFile,$ErrCSVFile -To $MailTo -From $MailFrom -Subject "Enable Mail Users Script" -BodyAsHtml $Output -SmtpServer $MailServer
    Else{
    Send-MailMessage -Attachments $CSVFile -To $MailTo -From $MailFrom -Subject "Enable Mail Users Script" -BodyAsHtml $Output -SmtpServer $MailServer
    if ($ScheduleAs)
    _UpProg1 99 "Attempting to Schedule Task.." 4
    $dir=(split-path -parent $myinvocation.mycommand.definition)
    $params=""
    if ($SendMail)
    $params+=' -SendMail:$true'
    $params+=" -MailFrom:$MailFrom -MailTo:$MailTo -MailServer:$MailServer"
    $task = "powershell -c \""pushd $dir; $($myinvocation.mycommand.definition) $params\"""
    Write-Output "Attempting to schedule task as $($ScheduleAs)..."
    Write-Output "Task to schedule: $($task)"
    schtasks /Create /RU $ScheduleAs /RP /SC DAILY /ST 22:00 /TN "Enable Mail Users" /TR $task
    The Problem is that when I look at the $errOutput I see things but when I pipe the $erroutput to convertTo-CSV I get this within the CSV file. I think its because I an calling a function to do the updating. But not sure.
    Jeff C

    Hi Jeff,
    Any updates? If you have any other questions, please feel free to let me know.
    A little clarification to the script:
    function _ErrObject{
    Param($name,
    $errStatus
    If(!$err){
    Write-Host "error detected"
    $script:err = $True
    $ErrObject = New-Object -TypeName PSObject
    $Errobject | Add-Member -Name 'Name' -MemberType Noteproperty -Value $Name
    $Errobject | Add-Member -Name 'Comment' -MemberType Noteproperty -Value $errStatus
    $script:ErrOutput += $ErrObject
    $errOutput = @()
    _ErrObject Name, "Missing External Email Address"
    $errOutput
    _ErrObject Name "Missing External Email Address"
    $errOutput
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support

  • CS6: cropping a picture and repeat this on another picture?

    Hi,
    I have several pictures. Each "pair of picture" shows the same person on the same background/perspective/settings (using a tripod) -- but with the person on a different position.
    Now I want to crop these pairs of pictures. Now I am recording my cropping of the first picture as an action and repeat the same step via this action on the second picture.
    But it is possible eg to record my cropping via a shortcut and execute the cropping with another shortcut to the next picture (the "next actually opened" picture) just to do this faster?
    Thanks!
    mtemmp

    the problem is that I each pair of photos needs a different cropping area. At the moment I record my cropping in the first picture. Than changing to the other picture and  executing only this last recording step of my action.
    Then I repeat this procedure with 150 further "pairs of photos"...
    Thus I thought there would be a "smoother" procedure, recording only one step (the cropping) after pressing a shortcut, then executing my cropping via another shortcut. Not less, not more
    But okay, I will proceed with my solution, clicking in the action panel...

  • On ipad app, i add a signature and then save and email, but the attachments never comes through on the email. Help??

    So I add a signature on the ipad, save and then attach to an email and send. The attachment never comes through. I have tried multiple email addresses. Help? I also tried saving to my docs on adobe.com and then logging in on a computer to retrieve and print, but thats not showing up either.

    Thank you.  That is very useful information!
    We would like to investigate the problem further and fix it.  If it's OK with you, we would also like to collect more information so that we can reproduce the problem at our end.
    What is the iOS version?
    What is the version of your Adobe Reader?
    What is the mail app that you use to read and open email messages and attachments?
    Does the problem occur with any PDF documents (for both cases: with or without a signature)?  Or just a particular PDF document?
    Would you send the original PDF document (without a signature) that exhibits the problem as an email attachment to [email protected]?  Please include the link to this forum post (https://forums.adobe.com/thread/1520043) in your email message for reference.
    Thank you for your help!

  • Script that enables Remote Management and adds user

    I need to make a script that can enable Remote Management and add a user to control it.
    I have tried to watch which plist files it uses so I could edit those.
    It writes some text in com.apple.RemoteManagement.plist and com.apple.ARDAgent.plist bit I can't find where the user is added.
    Any ideas guys
    Thanks

    No need to mess around with .plists. ARD has a command-line admin tool. The syntax is a little funky, but this should give you an idea:
    $ sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/k ickstart -activate -configure -access -on -users john -restart -agent -privs -all
    This is all covered in more detail in Apple's technote.

  • Cannot open Pages documents that I've worked on.  I open a new document, work on it, then save and close it.  When I try to open the document again, I get the following message: The document "[name]" could not be opened. The file isn't in the correct form

    I cannot open Pages documents that I have worked on and saved.  When I try to reopen Pages documents that I've saved, I get the following
    message:
    "The document “[name of document]” could not be opened. The file isn’t in the correct format.
    The file might be corrupted, truncated, or in an unexpected format."
    I have downloaded the latest update to iWork, but that doesn't help.
    I use Mac OSX 10.6.7
    I am using Pages '09 version 4.0.5 (852)
    If anyone can help, I would greatly appreciate it.
    Best regards,
    New York Mac User

    A few general trouble shooting tips that may apply here:
    1. If you used Software Update to do the OS update(s) to reach 10.6.7, go to http://support.apple.com/downloads/ and download and apply the Mac OS v10.6.7 Combo Updater. The Combo Updater contains some fixes that were not included in the incremental updaters used by Software Update.
    1a. Check that you have the current version of Pages (and of the other iWork applications) installed. All three applications' current version numbers end in .0.5
    2. A common cause of malfunctioning applications is a corrupted preferences file (.plist file). Your Pages '09's plist is at yourname > Library > Preferences > com.apple.iWork.pages.plist
    Quit Pages, locate the file and Drag it to the Desktop (or to the Trash).
    Restart Pages and attempt to open one of the files.
    If all is well, Trash the plist file and empty the Trash.
    If there's no change, AND you've made changes to the Preferences that you wish to keep, drag the file back to its previous location, replacing any new one that has been created.
    Regards,
    Barry

  • HT201210 My iPod starts to turn on , then it will go white then turn off, then on and repeat.. If I do these steps, will it help ?

    Just questioning this.
    It says to update software , so I do but once it finishes updating it turns black and turns on with the picture saying I must connect to iTunes.. I tried doing that but for some reason iTunes kept popping up saying that it was in recovery mode and I need to fix it.. so I clicked the button saying restore and 2 times it said it couldn't do it. but the third time it did and once it updated my iPod screen went completely black.. then it turned on as if it was starting up, and it stayed like that for about 5 minutes.. then the screen would flash, turn off, then start up again. It keeps repeating this until my batttery is flat and by that time it tells me to plug it in to a power source. I plug it into the power source hoping it would fix it but it doesn't...once its recharged it starts up the whole, coming on , screen going white, then turning off again and so on. I only just bought my iPod 2 weeks ago so I don't know whats wrong... HELP?
    Cheers,
    Chelsea

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iPod fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar

  • After a reset of settings on IPad2 it turns "on" but i only get to the logo screen with the progress bar under it. so it turns on to logo then to progress bar screen then off. and repeats over and over

    Well as I said in the "question", I did a reset of the settings on my IPad2. however when it powered back on from resetting. it lets the the logo screen with the progress bar under it. The progress bar gets about 1/4 of an inch from the left then stops. After a few mins Ipad shuts off then turns on to the logo screen, then goes to the logo/progress bar screen, does whats said above, then off. That cycle just repeats over and over. Any help with this would be appreciated.

    Recovery Mode Step by Step
    1. Hold Sleep/Wake button down and slide to turn off iPad
    2. Turn on computer and launch iTune (make sure you have the latest version of iTune)
    3. Plug USB cable into computer's USB port
    4. Hold Home button down and plug the other end of cable into docking port. Do not release button until you see picture of iTune and plug.
    5. Release Home button.
    On Computer
    6. iTune has detected iPad in recovery mode. You must restore this iPad before it can be used with iTune.
    7. iPad Recovery Mode on computer screen
    8. Select "Restore iPad"...
    9. Select "Restore and Update"
    10. Extracting Software.
    11. Preparing iPad for restore.
    12. Waiting for iPad.
    13. Verifying iPad restore...
    14.Restoring iPad software.
    15. Verifying iPad software.
    16. Verifying iPad Restore...
    17. Restoring iPad firmware...
    18. Your iPad is restored to factory settings; keep iPad connected to computer
    19. Activate iPad
    20. Enter Apple ID and Password
    21. Continue
    22. Welcome to Your New iPad
    (a) Set up as new iPad   (b) Restore from this backup (select from list of backups)
    23. Restore from this backup
    24. Continue
    25. Restoring iPad from backup
    26. The settings of your iPad have been restore; keep iPad connected to computer
    27. Syncing iPad (Step 1 to 5)
    28. Preparing apps to sync
    29. Copying 1 of 9
    30. Sync apps, movies and music to iPad
    31. Finishing syncing
    32. Eject iPad

  • Script that takes 2 images and overlays one on the other

    I have a folder with 200 raw images in it. 100 of them might be called 1001-1001-1072 (Yellow).jpg and it's sister image would be 1001-1001-1072 (Yellow)_Overlay.jpg - making 200 images. The next image in the series might be 1001-1001-1073 (Red).jpg. It's really the last string of numbers that the script should look at.
    Basically each image will have a sister image that will be used in photoshop as an overlay layer (of a script defined percentage). Can one of you geniuses create a script for me that will do this to all the images in a folder?
    I'd like to use this inside of an action, if that means anything in the script parameters...
    Thanks in advance for trying -
    Ian

    Sorry, the correct layer interaction should be SCREEN on top of the other image, not Overlay.
    tnx

  • I have a video downloaded from my camera in iPhoto and I wish to freeze frame one shot and make it a photo that I can save and print.  Any way to do this on my Mac?

    I have a video downloaded from my camera in iPhoto and I wish to freeze a frame of the photo and make it a picture to be saved and printed.  Can I do this on my Mac?

    Open the video in QuickTime Player.
    Scrub to the frame.
    Edit/Copy.
    Open Preview.
    File/New From Clipboard.
    File/Save...

  • Looking for script that will connect product and shopping cart

    I'm looking where I can find the script to make the product price or any other specifacations work with the shopping cart. Does anybody know where I can find this script at online?
    Thanks
    Bobby

    I'm looking where I can find the script to make the product price or any other specifacations work with the shopping cart. Does anybody know where I can find this script at online?
    Thanks
    Bobby

  • Script to crop (no delete pixel) snap to ruler guide

    Hi everyone,
    I manually make 1 ruler guide and automatically create 3 ruler guides. These 4 ruler guide form a rectangular.
    Could I have a script that crop my image (no delete pixel) to fit that rectangular formed by the 4 guides .
    Thank you in advance for your help!

    I had a fight scripting it. Strange thing were happing when I was testing. There seems to be a bug in scripting in cs6 -> CC 2014. Re-size layer seems to back up a history step. undoing the last step.  When I was using suspend history states I was loosing the last guide I set or the layer mask from my last test that I deleted the mask was restored and the script would fail.
    http://www.mouseprints.net/old/dpr/FitImageToGuides.jsx
    /* ==========================================================
    // 2014  John J. McAssey (JJMack)
    // ======================================================= */
    // This script is supplied as is. It is provided as freeware.
    // The author accepts no liability for any problems arising from its use.
    /* Help Category note tag menu can be used to place script in automate menu
    <javascriptresource>
    <about>$$$/JavaScripts/FitImageToGuides/About=JJMack's FitImageToGuides .^r^rCopyright 2014 Mouseprints.^r^rFour and only four guides are required</about>
    <category>JJMack's Script</category>
    </javascriptresource>
    // enable double-clicking from Mac Finder or Windows Explorer
    #target photoshop // this command only works in Photoshop CS2 and higher
    // bring application forward for double-click events
    app.bringToFront();
    // ensure at least one document open
    if (!documents.length) alert('There are no documents open.', 'No Document');
    else {
      // declare Global variables
      main(); // at least one document exists proceed
      //app.activeDocument.suspendHistory('Fix Image to Guides','main()');  // seems to be a problem layer is resize Photoshop back up a history step ?
    //                            main function                                  //
    function main() {
      // declare local variables
      var orig_ruler_units = app.preferences.rulerUnits;
      var orig_type_units = app.preferences.typeUnits;
      var orig_display_dialogs = app.displayDialogs;
      app.preferences.rulerUnits = Units.PIXELS; // Set the ruler units to PIXELS
      app.preferences.typeUnits = TypeUnits.POINTS;   // Set Type units to POINTS
      app.displayDialogs = DialogModes.NO; // Set Dialogs off
      try { code(); }
      // display error message if something goes wrong
      catch(e) { alert(e + ': on line ' + e.line, 'Script Error', true); }
      app.displayDialogs = orig_display_dialogs; // Reset display dialogs
      app.preferences.typeUnits  = orig_type_units; // Reset ruler units to original settings
      app.preferences.rulerUnits = orig_ruler_units; // Reset units to original settings
    //                           main function end                               //
    // The real code is embedded into this function so that at any point it can return //
    // to the main line function to let it restore users edit environment and end      //
    function code() {
      if (app.activeDocument.guides.length != 4) { alert("Four and only four Guides are required"); return; } // quit
      // get guides;
      var theVert = new Array;
      var theHor = new Array;
      for (var m = 0; m < app.activeDocument.guides.length; m++) {
      if (app.activeDocument.guides[m].direction == Direction.HORIZONTAL) {theVert.push(app.activeDocument.guides[m].coordinate)}
      else {theHor.push(app.activeDocument.guides[m].coordinate)}
      if (theHor.length != 2 || theVert.length != 2) { alert("Four Guides two vertical and two horizontal are required"); return; } // quit
      getTarget=getSelectedLayersIdx();
      if (getTarget.length!=1){ alert("The number of layers targeted is " + getTarget.length ); return; } // quit
      if (app.activeDocument.activeLayer.isBackgroundLayer ) { alert("Can not resize the background layer"); return; } // quit
      if (!app.activeDocument.activeLayer.visible ) { alert("Active layer is  not visible"); return; } // quit
      //if (hasLayerMask()) { alert("Active layer is  Masked"); return; } // quit
      if (app.activeDocument.activeLayer.kind == LayerKind.NORMAL  || app.activeDocument.activeLayer.kind == LayerKind.SMARTOBJECT && hasLayerMask()) { deleteLayerMask ();}
      if (app.activeDocument.activeLayer.kind != LayerKind.NORMAL  && app.activeDocument.activeLayer.kind != LayerKind.SMARTOBJECT )  {
      alert("Active layer is " + app.activeDocument.activeLayer.kind); return; } // quit
      // set selection to the ared defined but the guide lines the selectiom may get undone bt the bug in .resize() backing up a steo in histoty ???
      app.activeDocument.selection.select([[theHor[0], theVert[0]], [theHor[1], theVert[0]], [theHor[1], theVert[1]], [theHor[0], theVert[1]]]);
      // resize current normal layer or smart object layer to just cover selection canvas area aspect ratio and size and mask off any overflow
      var SB = app.activeDocument.selection.bounds; // Get selection bounds
      var SWidth = (SB[2].value) - (SB[0].value); // Area width
      var SHeight = (SB[3].value) - (SB[1].value); // Area height
      var LB = app.activeDocument.activeLayer.bounds; // Get Active layers bounds
      var LWidth = (LB[2].value) - (LB[0].value); // Area width
      var LHeight = (LB[3].value) - (LB[1].value); // Area height
      var userResampleMethod = app.preferences.interpolation; // Save interpolation settings
      app.preferences.interpolation = ResampleMethod.BICUBIC; // resample interpolation bicubic
      try {
      if (LWidth/LHeight<SWidth/SHeight) { // layer's Aspect Ratio less the Canvas area Aspect Ratio
      var percentageChange = ((SWidth/LWidth)*100); // Resize to canvas area width
      app.activeDocument.activeLayer.resize(percentageChange,percentageChange,AnchorPosition.MIDDLECENTER);
      else {
      var percentageChange = ((SHeight/LHeight)*100); // resize to canvas area height
      app.activeDocument.activeLayer.resize(percentageChange,percentageChange,AnchorPosition.MIDDLECENTER);
      catch(e) {
      app.preferences.interpolation = userResampleMethod; // Reset interpolation setting
      selectFront(); // Photoshop make top layer current when none are targeted
      code(); // Retry  with top visible layer selected targeted
      return; // rest would have been done during the retry
      app.preferences.interpolation = userResampleMethod; // Reset interpolation setting
      // Seems to be a bug in  resize() the document seems to first be backed up a step in history
      app.activeDocument.selection.select([[theHor[0], theVert[0]], [theHor[1], theVert[0]], [theHor[1], theVert[1]], [theHor[0], theVert[1]]]); // redo the selection
      align('AdCH'); // align to horizontal center
      align('AdCV'); // align to vertical center
      addLayermask(); // add layer mask
    // Helper Functions
    function align(method) {
      var desc = new ActionDescriptor();
      var ref = new ActionReference();
      ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
      desc.putReference( charIDToTypeID( "null" ), ref );
      desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );
      try{executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );}
      catch(e){}
    // Function: hasLayerMask
    // Usage: see if there is a raster layer mask
    // Input: <none> Must have an open document
    // Return: true if there is a vector mask
    function hasLayerMask() {
      var hasLayerMask = false;
      try {
      var ref = new ActionReference();
      var keyUserMaskEnabled = app.charIDToTypeID( 'UsrM' );
      ref.putProperty( app.charIDToTypeID( 'Prpr' ), keyUserMaskEnabled );
      ref.putEnumerated( app.charIDToTypeID( 'Lyr ' ), app.charIDToTypeID( 'Ordn' ), app.charIDToTypeID( 'Trgt' ) );
      var desc = executeActionGet( ref );
      if ( desc.hasKey( keyUserMaskEnabled ) ) { hasLayerMask = true; }
      catch(e) { hasLayerMask = false; }
      return hasLayerMask;
    function getSelectedLayersIdx(){
          var selectedLayers = new Array;
          var ref = new ActionReference();
          ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
          var desc = executeActionGet(ref);
          if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
             desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
              var c = desc.count
              var selectedLayers = new Array();
              for(var i=0;i<c;i++){
                try{
                   activeDocument.backgroundLayer;
                   selectedLayers.push(  desc.getReference( i ).getIndex() );
                }catch(e){
                   selectedLayers.push(  desc.getReference( i ).getIndex()+1 );
           }else{
             var ref = new ActionReference();
             ref.putProperty( charIDToTypeID("Prpr") , charIDToTypeID( "ItmI" ));
             ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
             try{
                activeDocument.backgroundLayer;
                selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" ))-1);
             }catch(e){
                selectedLayers.push( executeActionGet(ref).getInteger(charIDToTypeID( "ItmI" )));
          return selectedLayers;
    function selectFront() {
    // Alt+. shortcut select ftont visible layer
    var idslct = charIDToTypeID( "slct" );
        var desc250 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref207 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idFrnt = charIDToTypeID( "Frnt" );
            ref207.putEnumerated( idLyr, idOrdn, idFrnt );
        desc250.putReference( idnull, ref207 );
        var idMkVs = charIDToTypeID( "MkVs" );
        desc250.putBoolean( idMkVs, false );
    executeAction( idslct, desc250, DialogModes.NO );
    function deleteLayerMask (apply) {
    // Delet Layer mask default to not apply first
    if (apply == undefined) {var apply = false};
    try {
    var idDlt = charIDToTypeID( "Dlt " );
        var desc9 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref5 = new ActionReference();
            var idChnl = charIDToTypeID( "Chnl" );
            var idChnl = charIDToTypeID( "Chnl" );
            var idMsk = charIDToTypeID( "Msk " );
            ref5.putEnumerated( idChnl, idChnl, idMsk );
        desc9.putReference( idnull, ref5 );
        var idAply = charIDToTypeID( "Aply" );
        desc9.putBoolean( idAply, apply );
    executeAction( idDlt, desc9, DialogModes.NO );
    catch (e) {}
    function addLayermask(){
    // Add layer Mask
    var idMk = charIDToTypeID( "Mk  " );
        var desc52 = new ActionDescriptor();
        var idNw = charIDToTypeID( "Nw  " );
        var idChnl = charIDToTypeID( "Chnl" );
        desc52.putClass( idNw, idChnl );
        var idAt = charIDToTypeID( "At  " );
            var ref19 = new ActionReference();
            var idChnl = charIDToTypeID( "Chnl" );
            var idChnl = charIDToTypeID( "Chnl" );
            var idMsk = charIDToTypeID( "Msk " );
            ref19.putEnumerated( idChnl, idChnl, idMsk );
        desc52.putReference( idAt, ref19 );
        var idUsng = charIDToTypeID( "Usng" );
        var idUsrM = charIDToTypeID( "UsrM" );
        var idRvlS = charIDToTypeID( "RvlS" );
        desc52.putEnumerated( idUsng, idUsrM, idRvlS );
    executeAction( idMk, desc52, DialogModes.NO );
    // Un link layer mask just added fron the layers content
    var idsetd = charIDToTypeID( "setd" );
        var desc2 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref1 = new ActionReference();
            var idLyr = charIDToTypeID( "Lyr " );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idTrgt = charIDToTypeID( "Trgt" );
            ref1.putEnumerated( idLyr, idOrdn, idTrgt );
        desc2.putReference( idnull, ref1 );
        var idT = charIDToTypeID( "T   " );
            var desc3 = new ActionDescriptor();
            var idUsrs = charIDToTypeID( "Usrs" );
            desc3.putBoolean( idUsrs, false );
        var idLyr = charIDToTypeID( "Lyr " );
        desc2.putObject( idT, idLyr, desc3 );
    executeAction( idsetd, desc2, DialogModes.NO );

  • After downloading ver 4.0, i do not have the option of "exiting" or "sava and exit." Only "exit"

    My most favorite benefit of Firefox is that I can "save and exit" I recently downloaded the newest version , 4.0. Since then when I goto "file>exit> click to execute, I am not given the option of "save and exit" How do I get this feature back?

    Firefox now always stores the old session, and you can access it by going to the History menu and selecting "Restore Previous Session"
    If you want Firefox to display the message to save the session, it can be turned back on by changing some preferences.
    # Type '''about:config''' into the location bar and press enter
    # Accept the warning message that appears, you will be taken to a list of preferences
    # Locate the preference '''browser.tabs.warnOnClose''', if its value is set to '''false''', double-click on it to change its value to '''true'''
    # Repeat this for these 3 preferences '''browser.warnOnQuit''', '''browser.warnOnRestart''' and '''browser.showQuitWarning'''
    If you always open the last set of tabs, an alternative approach is this:
    # Click the orange Firefox button, then select options to open the options window
    # Go to the General panel
    # Change the setting "When Firefox starts" to "Show my windows and tabs from last time"

  • BUG: "Save and compact" increases file size by 1KB each time?

    Flash CS4
    I noticed that when I do "save and compact" on a .fla file, it causes the file size to increase by 1KB each time--even when no changes were made.  Can this be fixed?

    Yup. It works perfectly in CS3. Now the problem you will have is that you don't have CS3 installed. Even if you will save your files as CS3 format, you cannot (as far as i know) "save and compact" it as CS3, it will prompt that it must be converted from older version CS3 to CS4 and you end up with the same problem. Perhaps there is a setting to force CS4 to save and compact in CS3 version but i doubt it. The only way i know to solve it is save the file as CS3 format (But you will lose some XMP file info metadata, i'm not sure if that is necessary though) then close CS4, and open CS3 then "save and compact" it there. This is definitely a bug where some information might have been duplicated in the file's info or history. If you are lucky an adobe employee might be able to give you a solution to this or just confirm this bug.

  • How to Create, Save and Restore a Custom Catalog in PE 6?

    I am having great difficulty in trying to create a custom catalog using the organizer function of PE 6. Upon opening the organizer I have many photos already depicted in it. So, I highlight them all and delete them obtaining a blank screen with no photos. I then import the file containing only the custom photos I want to catalog. I then backup this catalog using the following procedure http://www.backuphowto.info/how-to-backup-adobe-photoshop-elements-6-catalogue Everything looks fine until I try to restore it at a future time. It doesn't restore! In fact I can browse to the saved file but am unable to get the locate backup file location to change to it??
    What am I doing wrong and can anyone help me acheive my objective of creating a custom catalog that I can save and retrieve intact for later use?
    Thanks, in advance, for any help provided. Oh, and I need to add I am relatively new to PE 6 having only previously used PE 4 and never used the organizer in it which is to say -  lead me very simply please.
    Sanray19

    sanray19 wrote:
    I am having great difficulty in trying to create a custom catalog using the organizer function of PE 6. Upon opening the organizer I have many photos already depicted in it. So, I highlight them all and delete them obtaining a blank screen with no photos. I then import the file containing only the custom photos I want to catalog.
    I can't imagine the purpose of a "custom catalog". Seems to me you have done a lot of work when I am 100% sure there is an easier way to do whatever it is you are trying to accomplish. Further, it seems like you are trying to create a backup of only some of your photos, and I can't imagine the purpose of that either ... I would presume you would want to make backups of your entire collection of photos.
    Just as a general rule, there usually isn't a good reason to have more than one catalog (unless you have separate categories of photos, like personal and work).
    Everything looks fine until I try to restore it at a future time. It doesn't restore!
    Can you give us a detail or two about what happens when "it doesn't restore"? Can you give us more details about what you actually did? And most importantly, can you describe what you see on the screeN? Screen captures would be even better.

Maybe you are looking for