Using Applescript to crop images in Photoshop
Hi I came across this thread in the archive
http://discussions.apple.com/thread.jspa?threadID=1557555
It contains a script for cropping any image to a square image which is great but what I want is to crop the image to any size I want. I think the relevant part of the script is the following fragment - could anyone explain what is going on with this code and how I could adapt it to be able to crop/resize images to whatever size I want? thanks a lot
crop docRef bounds {(docWidth - minDimension) / 2, (docHeight - minDimension) / 2, (docWidth + minDimension) / 2, (docHeight + minDimension) / 2}
Assume an 800*600 graphic...
set minDimension to docWidth
if docWidth > docHeight then set minDimension to docHeight
set to 800, if 800 more than 600, set to 600
crop docRef bounds {(docWidth - minDimension) / 2, (docHeight - minDimension) / 2,
(800-600)/2 = 100, (600-600)/2 = 0... the top left x/y coordinates of the crop box.
(docWidth + minDimension) / 2, (docHeight + minDimension) / 2}
(800+600)/2 = 700, (600+600)/2 = 600...the bottom right coordinates of the crop box.
We now have a centered 600*600 crop box that leaves off the left 100 & right 100 pixels.
Going from x=100, y=0 top left corner to x=700, y=600 bottom right corner.
Similar Messages
-
How to insert cropped images from photoshop without the white background
Basically all I want to do is take a peice of writing from a video and insert it into another video. To do this I've took a screenshot of the font from the video and imported it into photoshop. I've then cropped/cut/took the the peice of writing I want, letter by letter. I want to be able to insert it into another video, but whenever I attempt to do it, I have the default white background of photoshop. Is there anyway to insert an image from photoshop, without taking the background with it, or even insert a layer from photoshop straight into final cut pro? Sorry if this is confusing.
I don't think so. I cropped the letters, put them each an individual file, removed the background, saved them as a TIF then tried to import them onto Final Cut Pro, but a white background still appeared in the TIF file. Basically I just want to make the background transparent I believe.
-
Using the new Crop tool | Learn Photoshop CS6 | Adobe TV
Cropping is one of the most common operations in Photoshop. So it's only fitting that the Crop tool has experienced a quantum leap in CS6. In this movie, watch how to preview the angle of your image to confirm that your crop is plumb. You can revisit a crop any time you like, so you never waste effort. And by default, the Crop tool hides pixels instead of permanently deleting them.
http://adobe.ly/Jo38ykI just installed the new PhotoShop CS6 on my iMac - I am used to it on Windows PC. Now, when I crop, it does not resize the image to my 640x320 px (it keeps the original size)
-
Cropping Images In Photoshop CS6
I am trying to learn how to use photoshop cs 6.
However I've been watching a video and I just can't figure it out.
Here is the video that shows how to crop the images into same size.
http://blogs.adobe.com/jnack/2012/07/tip-cropping-two-images-to-the-same-size-in-photoshop -cs6.html
But my photoshop does not have that 'crop size and resolution' thing .. (image)
can anyone help?Please help!
-
Scratch Disk Full While Cropping Image In Photoshop
I saw another post on this, but they were able to resolve their issue on their own. I still think I have an issue.
I have a Macbook Pro (80GB harddrive where I've only used 51GB). A couple of days ago I upgraded the RAM from 512MB to 2GB. I recently used Adobe Photoshop CS (ver.8.0), and while attempting to crop an image (22.8MB), an error pops up saying: "could not complete your request because scratch disks are full".
Now my scratch disk, I have the following:
1st: Startup
2nd: Hard drive
3rd: none
4th: none
So, with this set up (and even if I make the image smaller), their is not enough scratch disk space. I have plenty of space in my harddrive. Wondering if the recent upgrade of RAM has anything to do w/ this situation. Anyway, any advice is much appreciated.
Thank you in advance.
C.Bob,
Activity Monitor says I have plenty of memory.
"Memory" refers to RAM, whereas the "scratch disk" is your hard drive. 50 GB available before you start working with Photoshop files may seem a lot, but when you open large files, it is not that much. It may really run full. If the same is the case with a little 4 MB file (without having just worked on a 30 MB file during the same session), this is really weird.
Check your disk space with Activity Montor and select +Hard Disk load+ (or something like this; I don't work on an English OS). CPU > Memory > Hard Disk Activity > *Hard Disk Load* > Network.
Have you got an external hard drive with more than 50 GB free that you could use as a scratch disk test drive instead of your internal?
Peter -
Bridge CS4 not using newly installed Enhanced Image Processing Photoshop script
Hi all,
Hope someone can help here. We just added this Photoshop extention: Enhanced Image Processor by Manovi to our Photoshop CS4's Presets/Scripts folder. Here's my problem. The new image processor opens and runs great - in Photoshop. But when I'm in Bridge CS4 and choose Tools>Photoshop>Image Processor it opens/uses the old script. Does Bridge cache this kind of thing or what's going on.
How can I get Bridge to use the new image processor? (note: Old script was replaced by new one in Photoshop's preset/scripts folder - the old one is no longer there - although we did save a copy of it elsewhere)
ThanksI don't have CS4… but in CS5 the paths to the files in Photoshop's scripts folder are coded into the functions that call them… Bridge reads these files on request evaluates them then runs… I would suspect the file name may differ from what it's looking for… Have you tried calling it the same and placing it in the same location? If this fails you may need someone to edit the Bridge startup script (not a job for the faint hearted)… Sorry but that ain't going to be me it uses localized strings don't understand them yet… Paul R may well say he can do it I don't know… So NOT cached… but possibly NOT read either in you case…
-
Crop image in Photoshop Elements 9
how do i crop a photo to these dimensions 1500 X 1500 -could someone please help?
It's Version Photoshop Elements 9 - (I don't know if they are asking me to crop 1500 mm or Pixels) could you help with both ?Dear sir or madam, when i went to (Image) on the tool bar and clicked "resize" then under the values blocks to be filled in, i typed the 1500 dimensions for both Height and Width in Pixels
- The Width automaitcailly changed it to 1640 ? whle the Height remaind the same and it shows at the top, overall Pixel dimensions 7.04M (i assume this is overall) ?
- The other way is to go direclty to the Edit / Create / Share columes off to the right hand side and under that is "QUICK" - there i am able to crop ...but when i type in 1500 on the upper value blocks it does not accept it ?
These are the only two wasy this version is allowing me to do anything... and i still don't know if any of it is right ?
The photos i have (that need to be exaclty 1500 x 1500 or 1200 x 1200 or 1700 x 1700) are at these dimensions currently:
1) Pixel Dimensions 11.8 M with a Width of 2125 Pixels
and Height of 1944 Pixels
2) Pixel Dimensions 13.5M with a Width of 2358 Pixels
and a Height of 1996 Pixels
OR if i chage each of them to Percents i can type in 1500 for Width but, it changes to closest value of 1272.26 Percent is what it reverts too
Sorry, coudl you help further ? -
Printing from Photoshop using AppleScript
I am working on a project that will automatically print an image that is moved to a folder.
Right now, I have the following working: the image from my camera saves to a folder on my desktop, then applescript opens the image in Photoshop and runs an action on it that resizes it, crops it, and then re-saves it into a different folder. Here's where my problem starts...
My printer - an Epson R800 - does not have a default paper size of 5x7 borderless. That selection has to be made in Photoshop, however, Photoshop actions will not capture paper settings. (Which I think is sooooo stupid, but that's another issue.)
When the image is dropped in the second folder, it currently automatically prints, but on "letter" size paper.
I need to script the following:
Tell Photoshop CS4 to open the image (well, I can do that), but then select the correct paper size (5x7 borderless), and print. I've tried a few different things and they aren't working.
Any help would be appreciated!
Thanks,
MichelleHere is a starter that is working just fine at work where I have access to CS2 and printers…
-- A path to an image file as text
set PrintImage to (path to desktop as text) & "HE2015.tif"
tell application "Adobe InDesign CS2"
activate
-- Turn off the app dialogs
tell script preferences
set user interaction level to never interact
end tell
-- Get the new document preset
set DocPreset to document preset "A4-P" -- Change here
-- Make our new doc
set PrintDoc to make new document at beginning ¬
with properties {document preset:DocPreset}
-- Get the printer preset
set PrintPreset to printer preset "Xerox A3-P-SEF" -- Ditto Here
tell PrintDoc
set DocWidth to page width of DocPreset
set DocHeight to page height of DocPreset
-- Add a rectangle to hold the image
set ImageFrame to make new rectangle at beginning ¬
with properties {geometric bounds:{0, 0, DocHeight, DocWidth}}
tell ImageFrame
-- Put our image in the rectangle
place PrintImage as alias
-- Fit our image to fill box keeping proportions
tell image 1
fit given fill proportionally
fit given center content
end tell
end tell
print using PrintPreset without print dialog
end tell
end tell
There are two strings that you will need to change one for a 'new document preset' and the second for a 'print preset'…
The example just uses an image off my desktop to test with… Any problems post in the Indesign forum as this no longer belongs here… -
Crop images to frame not working?
I searched the forums for this, but did not find a thread that directly addressed this issue. When I export pdfs from InDesign CC(2014), and use the setting "crop image data to frames" checked on, but do not otherwise downsample or compress the images, the images are NOT cropped to the frame edges. I found this out with the "edit in Photoshop" from the tools in Acrobat Pro (XI). I have not tested with other settings for downsampling, as I don't want to downsample these images. These particular images are scans from a copier/printer - bitmap images. I understand that it does not work on vector data, but this is not vector.
Do You have to use "crop" or can You use "canvas size"? It's easily doable with a small script. Something like this
http://pastebin.com/r0EtBj1U
Copy the content, and paste it in a document with a text editor. Save the document as "MaxCanvas.jsx", and run it via "File -> Scripts" in Photoshop; or via an action or "whatever". Works like a charm but i only tested in Photoshop CC on Maverics. -
Olympus E500 RAW Image in Photoshop Elements 4.0
I am trying to find out if anyone has worked with the Olympus RAW Image (.orf) in Photoshop Elements. I downloaded the plug-in from the Olympus America site and installed it into Elements. Although the plug-in said that it was for Photoshop 5.0 or higher it loaded fine. However, when I open an image in Elements the interface is very basic and does not look at all like the Elements 4.0 interface. Thus I am wondering if anyone else has tried to use the Olympus RAW image with Photoshop and found a better plug in?
Alternatively is someone can give me some other input on how to edit these photos I would be appreciative.You want to ditch that Olympus plug-in - i.e., take it out of the plug-ins
folder in Elements - and make sure you have the version of Adobe Camera Raw
which covers your camera. Once you find that, install it in place of the
one that shipped with Elements (probably 2.4) and your images ought to open
directly into ACR. -
Crop Image using applescript?
Hi all
I'm trying to set up a script that will batch crop a bunch of files to 320X320 (album artwork size). However, I have yet to come across a sample/tutorial of how to set up the actual crop commands. Is cropping images even possible with applescript?You're right it does work now!
I've tried to adapt Camelot's code to my version of the script but for some reason, the images don't get cropped.
here is my code so far:
-- global variable declarations
global _widthHeight
global _folderA
global _folderB
global _workFilesInA
global _workFilesInB
global _theImage
set _widthHeight to the text returned of (display dialog "Enter dimension for width and height:" default answer "320")
set _folderA to (choose folder)
tell application "Finder"
set _workFilesInA to every file of folder _folderA
end tell
tell application "Finder" -- creation of temporary folder
if (the folder "path:processedImages" exists) then
set _theAns to the button returned of (display dialog "A folder named processedImages already exists." buttons {"Cancel", "Yes"} default button "Yes")
if _theAns is "Yes" then
tell application "Finder"
delete the folder "path:processedImages"
set _folderB to (make new folder at "path:Desktop:" with properties {name:"processedImages"})
end tell
end if
else
set _folderB to (make new folder at "Path:Desktop:" with properties {name:"processedImages"})
end if
end tell
-- work code
if (count of _workFilesInA) is not 0 then
repeat with i from 1 to count of _workFilesInA
try
tell application "Finder"
duplicate item i of _folderA to _folderB
end tell
on error errmess
display dialog "This error occured: " & errmess
end try
end repeat
end if
tell application "Finder" -- crop files in temporary folder
set _folderB to "Path:processedImages"
set _workFilesInB to every file in folder _folderB
tell application "Image Events"
repeat with i from 1 to count of _workFilesInB
crop item i to dimensions {_widthHeight, _widthHeight} **********
save item i
end repeat
end tell
end tell
everything works up to the **********. The events log tells me that the items were cropped (it even cycles through the), but upon inspecting the images, no cropping is evident. -
Moving a layer in Photoshop CS5 using Applescript
I have a layer in a document called "logo" and i want to duplicate it to every open document and then move it to a specific spot in each document
I got the duplicating thing happening but cant seem to move the bounds of the layer (says it is read only and cannot be changed)
here is what I have written
tell application "Adobe Photoshop CS5"
activate
set theDocs to count of documents
repeat with i from 1 to theDocs
duplicate art layer "logo" of current document to document i
end repeat
repeat with i from 1 to theDocs
set current document to document i
tell document i
set bounds of art layer "logo" to {0.456666666667, 6.38, 2.88, 6.77}
--Adobe Photoshop CS5 got an error: Property is read/only and cannot be changed
end tell
end repeat
end tell
This doesn't error but also doesn't move the logo at all
tell application "Adobe Photoshop CS5"
activate
set theDocs to count of documents
repeat with i from 1 to theDocs
duplicate art layer "logo" of current document to document i
end repeat
repeat with i from 1 to theDocs
set current document to document i
tell document i
set properties of art layer "logo" to {bounds:{0.456666666667, 6.38, 2.88, 6.77}}
end tell
end repeat
end tell
anyone know what the language is to move the layer around?In any language the way to move a layer x,y is to use translate… You will need to do the math from current x,y to required x,y given a distance… A read only property is just that regardless of language… Here is a quick example of how I did this kind of thing using Applescript… I still do the same method now but use the ESTK instead…
tell application "Adobe Photoshop CS2"
activate
-- Store the app settings
set User_Rulers to ruler units of settings
set User_Dialogs to display dialogs
set ruler units of settings to pixel units
set display dialogs to never
set Doc_Ref to the current document
tell Doc_Ref
-- Store the image res so we can put it back
set Original_Res to resolution
-- Change to work at 72 dpi
resize image resolution 72 resample method none
-- Move horizontal 1 inch
translate layer 1 delta x 72 as pixels
-- Move vertical 1 inch
translate layer 1 delta y 72 as pixels
-- Read the bounds propety
set Layer_Bounds to bounds of layer 1
log Layer_Bounds
-- Move the layer using bounds to top/left
translate layer 1 delta x -(item 1 of Layer_Bounds) as pixels
translate layer 1 delta y -(item 2 of Layer_Bounds) as pixels
-- Put back the image res
resize image resolution Original_Res resample method none
end tell
-- Put back the app settings
set ruler units of settings to User_Rulers
set display dialogs to User_Dialogs
end tell
You should get the general idea of how this works from this. It should move the first layer across 1 inch, down i inch then put it top/left. It assumes you have a layer that is not a background layer nor is it locked in any way… -
Photoshop CC crop image size & resolution dialog box
In previous versions of Photoshop the "R" button displays the Crop Image Size & Resolution dialog box. Is this feature completely gone is CC? I can't find anything the even references this dialog box. Anyone out there have this issue?
In photoshop cc 2014, the size and resolution boxes will actually show on the tool options bar instead of a separate dialog window, by choosing W x H x Resolution from the drop-down menu.
http://helpx.adobe.com/photoshop/using/crop-straighten-photos.html -
I need your help with a decision to use iPhoto. I have been a PC user since the mid 1980’s and more recently have used ACDSee to manage my photo images and Photoshop to edit them. I have used ProShow Gold to create slideshows. I am comfortable with my own folder and file naming conventions. I currently have over 23,000 images of which around 60% are scans going back 75 years. Since I keep a copy of the originals, the storage requirements for over 46,000 images is huge. 180GB plus.
I now have a Macbook Pro and will add an iMac when the new models arrive. For my photos, I want to stay with Photoshop which also gives me the Bridge. The only obvious reason to use iPhoto is to take advantage of Faces and the link to iMovie to make slideshows. What am I missing and is using iPhoto worth the effort?
If I choose to use iPhoto, I am not certain whether I need to load the originals and the edited versions. I suspect that just the latter is sufficient. If I set PhotoShop as my external editor, I presume that iPhoto will keep track of all changes moving forward. However, over 23,000 images in iPhoto makes me twitchy and they are appear hidden within iPhoto. In the past, I have experienced syncing problems with, and database errors in, large databases. If I break up the images into a number of projects, I loose the value of Faces reaching back over time.
Some guidance and insight would be appreciated. I have a number of Faces questions which I will save for later.Bridge and Photoshop is a common file-based management system. (Not sure why you'd have used ACDSEE as well as Bridge.) In any event, it's on the way out. You won't be using it in 5 years time.
Up to this the lack of processing power on your computer left no choice but to organise this way. But file based organisation is as sensible as organising a Shoe Warehouse based on the colour of the boxes. It's also ultimately data-destructive.
Modern systems are Database driven. Files are managed, Images imported, virtual versions, lossless processing and unlimited editing are the way forward.
For a Photographer Photoshop is overkill. It's an enormously powerful app, a staple of the Graphic Designers' trade. A Photographer uses maybe 15% to 20% of its capability.
Apps like iPhoto, Lightroom, Aperture are the way forward - for photographers. There's the 20% of Photoshop that shooters actually use, coupled with management and lossless processing. Pop over to the Aperture or Lightroom forums (on the Adobe site) and one comment shows up over and over again... "Since I started using Aperture/ Lightroom I hardly ever use Photoshop any more..." and if there is a job that these apps can do, then the (much) cheaper Elements will do it.
The change is not easy though, especially if you have a long-standing and well thought out filing system of your own. The first thing I would strongly advise is that you experiment before making any decisions. So I would create a Library, import 300 or 400 shots and play. You might as well do this in iPhoto to begin with - though if you’re a serious hobbyist or a Pro then you'll find yourself looking further afield pretty soon. iPhoto is good for the family snapper, taking shots at birthdays and sharing them with friends and family.
Next: If you're going to successfully use these apps you need to make a leap: Your files are not your Photos.
The illustration I use is as follows: In my iTunes Library I have a file called 'Let_it_Be_The_Beatles.mp3'. So what is that, exactly? It's not the song. The Beatles never wrote an mp3. They wrote a tune and lyrics. They recorded it and a copy of that recording is stored in the mp3 file. So the file is just a container for the recording. That container is designed in a specific way attuned to the characteristics and requirements of the data. Hence, mp3.
Similarly, that Jpeg is not your photo, it's a container designed to hold that kind of data. iPhoto is all about the data and not about the container. So, regardless of where you choose to store the file, iPhoto will manage the photo, edit the photo, add metadata to the Photo but never touch the file. If you choose to export - unless you specifically choose to export the original - iPhoto will export the Photo into a new container - a new file containing the photo.
When you process an image in iPhoto the file is never touched, instead your decisions are recorded in the database. When you view the image then the Master is presented with these decisions applied to it. That's why it's lossless. You can also have multiple versions and waste no disk space because they are all just listings in the database.
These apps replace the Finder (File Browser) for managing your Photos. They become the Go-To app for anything to do with your photos. They replace Bridge too as they become a front-end for Photoshop.
So, want to use a photo for something - Export it. Choose the format, size and quality you want and there it is. If you're emailing, uploading to websites then these apps have a "good enough for most things" version called the Preview - this will be missing some metadata.
So it's a big change from a file-based to Photo-based management, from editing files to processing Photos and it's worth thinking it through before you decide. -
How do use the same crop for multiple images.
I have a number of images that I want to use the same crop on. Instead of go through the whole slow process for each image is there a way to use the same crop for all of the images?
And in iPhoto there was a way to copy the adjustment settings to multiple images, I can't see how to do that in aperture.Use the "Lift&Stamp" tool:
Crop one image.
Lift the crop using the "Lift" tool.
Select the other images.
Stamp the crop adjustment to all of them.
But caution: By default "Lift" will copy all Metadata tags and all adjustments, but the gps data. If you only want to transfer the cropping rectangle, deselect all lifted items but the crop adjustment before stamping.
Regards
Léonie
Maybe you are looking for
-
When we tried to open Thunderbird it wouldn't, saying no xul.dll. Tried renaming it xul2.dll. No joy so uninstalled Firefox. On re-install it wouldn't do it, going to a box saying Administrator and asking for a password. Used normal computer login on
-
Quite urgent Ken Burns effect problem
I am working on a documentary (due tomorrow afternoon). This is a fulll length piece and has hundreds of photographs in it. The trouble is; all the photographs when they where imported automatically got the Ken Burns effect... I want to de-effect the
-
my daughter was at a friends house and they set a password and couldn't remember it, now the Ipad is disabled, we never used a computer to sync to the ipad and now I can't get it to sync to iTunes to reset it, What can I do? thanks.
-
TS1436 Trying to burn a cd disc and receive error code 4450. What is this error code?
When burning a CD disc, The progress bar doesn't move and then I get an error code: 4450. My computer freezes up and no functions will work. I rebooted and downloaded the latest iTunes update but still receive error code 4450. Anyone have suggestio
-
How to install PHP on OS X 10.2?
Hi, I'm a bit confused. Ther are lots of PHP related files in the library folder, but when i try to open a php file (drag and drop onto safari dock icon), it just opens a blank browser window. How do i install php so i can open php files like this? T