Batch converting 120 files....(cropping bounding box & filetype change)

Emperor12

Member
Hi there. First time so help. =)

I am trying to batch convert a bunch of files. I want to crop the bounding box and then change from pdf to jpg or png. It works great when I open photoshop (with 1 file) because it asks me if I'd like to crop the bounding box (yes) and then I could set up a batch to change the file type....unfortunately I don't see a action for cropping the bounding box......and I don't know how to use that ghost thing that I have seen in google........any ideas? Much appreciated....
 
Photoshop supports scripting that can batch convert, update, and export the files. There are bunch of other programs that may or may not do exactly that you need, try infranview to begin. If you need help creating the photoshop script go to any freelancer website and they will do it in a snap
 
Hi there. First time so help. =)

I am trying to batch convert a bunch of files. I want to crop the bounding box and then change from pdf to jpg or png. It works great when I open photoshop (with 1 file) because it asks me if I'd like to crop the bounding box (yes) and then I could set up a batch to change the file type....unfortunately I don't see a action for cropping the bounding box......and I don't know how to use that ghost thing that I have seen in google........any ideas? Much appreciated....

How about with Acrobat? You can do this using an Action.
 
Leonard, which version of Acrobat? Version 9 did not anti-alias renders to raster image formats, the results were rather ugly. The common options were to render to a higher resolution and then resample the image down to remove the jaggies - or to rasterize into Photoshop. Did you fix this aliasing issue in X or XI?


Stephen Marsh
 
The import option with cropping to bounding box in photoshop I can not find in Acrobat...

I see with photoshop how you can automate - batch.....I choose the folder with all my pdf's to open ....and I do not mind having to click through each crop to bounding box window....but I do not see how to export them all to png's files..... =/
 
Scripts, image processor can run an action and save all open files.

The other way is to record the file save in an action and run it with "overrides" in the batch.

If I have time I will record an action for you that can be batched.

EDIT: This is a little tricky to do with actions, as they record too much info that is specific to the first document, which may not apply to later documents. Are all your 120 images the same bounding size, or do they vary? If they vary, are they surrounded by transparent pixels and the bounding area containing opaque or semi-transparent pixel content?


Stephen Marsh
 
Last edited:
The import option with cropping to bounding box in photoshop I can not find in Acrobat...

I see with photoshop how you can automate - batch.....I choose the folder with all my pdf's to open ....and I do not mind having to click through each crop to bounding box window....but I do not see how to export them all to png's files..... =/

In Acrobat you don't import with cropping. You will need to use the crop function.

In Photoshop you don't export to png; you will Save As...
 
If you really want to use Photoshop to do your task then on a mac you can use the following script to batch-open (rasterize/flatten) single pages PDF files in Photoshop and resave them as JPEG. Make sure all your source PDFs are in the same folder location. Just paste the following code in AppleScript editor, then click "Compile" then "Run". Alternatively, you can save this as an AppleScript application and double-click on the app icon to run it:

--tested with Photoshop CS5.1 on Mac OS 10.6.8
--defines source PDF folder location
set my_source to (choose folder with prompt "Choose source PDF folder") as string
--defines destination folder for the resulting rasterized JPEGs
set my_destination to (choose folder with prompt "Choose destination for the resulting rasterized JPEGs") as string
--next line is to only pick PDFs from the source folder
tell application "Finder" to set my_pdfs to every item in alias my_source whose kind is "Adobe PDF document"
tell application "Adobe Photoshop CS5.1"
activate
--in the next line you can set crop page: art box,bleed box,bounding box,crop box,media box,trim box -- you can also set your color mode and your resolution
set pspdf to {class:pDF open options, bits per channel:eight, crop page:crop box, mode:CMYK, resolution:300, use antialias:true}
--loop starts here
repeat with f in my_pdfs
open file (f as string) with options pspdf
tell document 1
--flatten image
flatten
--in the next line you can set quality of your JPEG file quality: from 0 to 12
save in my_destination as JPEG with options {embed color profile:true, format options:standard, quality:10}
--close after saving as JPEG
close saving no
end tell
end repeat
--loop ends
end tell
--open destination folder window when all files have been processed
try
tell application "Finder" to open my_destination
end try
 
Last edited:
Thanks guys. Literally paste that whole thing?

--tested with Photoshop CS5.1 on Mac OS 10.6.8
--defines source PDF folder location
set my_source to (choose folder with prompt "Choose source PDF folder") as string
--defines destination folder for the resulting rasterized JPEGs
set my_destination to (choose folder with prompt "Choose destination for the resulting rasterized JPEGs") as string
--next line is to only pick PDFs from the source folder
tell application "Finder" to set my_pdfs to every item in alias my_source whose kind is "Adobe PDF document"
tell application "Adobe Photoshop CS5.1"
activate
--in the next line you can set crop page: art box,bleed box,bounding box,crop box,media box,trim box -- you can also set your color mode and your resolution
set pspdf to {class:pDF open options, bits per channel:eight, crop page:crop box, mode:CMYK, resolution:300, use antialias:true}
--loop starts here
repeat with f in my_pdfs
open file (f as string) with options pspdf
tell document 1
--flatten image
flatten
--in the next line you can set quality of your JPEG file quality: from 0 to 12
save in my_destination as JPEG with options {embed color profile:true, format options:standard, quality:10}
--close after saving as JPEG
close saving no
end tell
end repeat
--loop ends
end tell
--open destination folder window when all files have been processed
try
tell application "Finder" to open my_destination
end try



??

I have never even used applescript editor..
 
Yes, paste that in AppleScript editor, then click "Compile" then "Run". Just follow script instructions, it will ask for a source folder (where your PDFs are), select that folder, click "choose" button. Same when it will ask for destination folder (where you need your JPEGs to be saved). Haven't had time to hard code/test much but it works as expected on my mac as long as your PDFs are in the very same location (same folder) and that they are single page PDFs. Hope it helps.
 
Just tried it...i selected the source and destination folders but all it did was open up photoshop....then nothing else..

I dont even mind opening the files manually and doing the cropping manually....if only I could save them all as png or jpg's once I have done this....it takes to long to click file - save as and all that, 200 times..
 
Last edited:
Sorry it doesn't work. As I mentioned, it works fine here but may not work on a different configuration. Very hard for me to troubleshoot from here. Before running the script, in AppleScript Editor go to Window/Event Log History. It will log what the script does and doesn't. Just copy what you got and Private Message me with the info, I'll see what I can do.
 
I got it. Open the files manually then script - image processor - "use opened files" =) thanks very much for taking the time and effort to help though. Much appreciated =)

EDIT--- Actually I spoke to soon........I thought that would work but it did not. It says "There were no source files that could be opened by Photoshop.".............not really sure why this didnt work..
 
Last edited:
Still no luck with image processor? As I mentioned earlier, the last resort is to record the save then batch it with overrides.

Stephen Marsh
 
No luck I still get this error "There were no source files that could be opened by Photoshop."

Unfortunately I am not sure how to record the save then batch it with overrides. =(

..pulling my hair out
 
In image processor, do you have the option selected to "use open images"?

_______

As a last resort, use a batch action to save all open images...

Have an image file open and record an action of the process of saving the file to the required location. Don't worry about the action recording the file name and save path, this can be overridden - all you need to do is capture the file save options. All you need to do is record the save as process.

Then file/automate batch: select the action set and action.

Source: open files

Destination: Folder, select the folder.

Important: TICK THE OVERRIDE ACTION SAVE AS COMMANDS BOX!!!

Select any other options as necessary.

Hit the OK button.

It should be as simple as that!

Now I only have to kill an another 1.5 hours before my flight...
 

Attachments

  • imageprocessor.jpg
    imageprocessor.jpg
    98.3 KB · Views: 211
  • batchaction.jpg
    batchaction.jpg
    159.7 KB · Views: 218
Last edited:
Colorblind, as always - you are an AppleScript demon!

Tested with CS5 and all is good.

Looking at the code, there are options for bit depth, colour mode, pdf box etc.

Is there any way to handle multi page documents? Or is the only option to split these first?


Stephen Marsh
 
Stephen, thanks for the good words. While Photoshop can rasterize any PDF page, I think you need to use another application to get the page amount info first. I will get back to you on this.
 

PressWise

A 30-day Fix for Managed Chaos

As any print professional knows, printing can be managed chaos. Software that solves multiple problems and provides measurable and monetizable value has a direct impact on the bottom-line.

“We reduced order entry costs by about 40%.” Significant savings in a shop that turns about 500 jobs a month.


Learn how…….

   
Back
Top