I have 300 png files. I want to trim each of them. But for this I need open each file and make changes (even if I make script for trimming and save it will be long to open each file and do trimming). Is there already made solution or some advice how to do it better and quickly.

Thanks in advance.

  • 300 .pngs? Why not let that run overnight? IMO Photoshop will clearly be your best option. Are you asking how to create a batch and automate the process you described? – bassplayer7 Apr 1 '13 at 23:20
  • I already have 300 images with transparent background inside. So I want to get rid of the transparent pixel around image inside png. So in Phothoshop I have ability to do it using Image->Trimming option. But for many files it is too boring and this process takes a lot of my time. Maybe is there any automation even without using photoshop. thanks. – Matrosov Alexander Apr 1 '13 at 23:53

Another option using ImageMagick:

mogrify -trim *.png

You can install it with brew install imagemagick after installing Homebrew.

| improve this answer | |
  • Nice and fast! Does wot it gone done said on the tin! – CMash Sep 16 '16 at 13:08
  • This is the answer. – jakethedog Oct 22 '16 at 8:24

Photoshop is a terrific software and ultimately is designed to save the end user time. So, since you are the owner of (or have access to) a license of PS, you have the right tool at your fingertips. I am going to assume you have the full version of Photoshop, not Elements. If you do have PS Elements, things may work differently, or not at all for you.

Preface: this should take you less then 10 minutes to take care of all 300 images, if it is just a matter of trimming them all. It may take you longer, however, since this is likely a first for you.

  1. Make sure all the images are in one folder.
  2. Open one of the images.
  3. Turn on the Actions Palette. (Window -> Actions).
  4. Create a new folder under Actions palette.
  5. Create a new action under your folder.
  6. It automatically starts recording.
  7. Trim the photo, and perform any procedures you normally do on the photo.
    • If you do any layer work, or other work that is more or less custom to each image during this process, things can get a little more tricky. Use keyboard shortcuts such as alt + [ and alt + ] to move between layers and make sure the right layer is selected. During this time, think automation. Try to think that every thing you do is being performed on 300 photos. PS doesn't record mouse clicks, it records actions, so simply clicking a layer may not have good results. You may want to create a folder in Finder which you can experiment with so you don't ruin any photos.
    • If it is as simple as running the Trim command, you are on easy terrain.
  8. After that photo is set, go ahead and save it like you would. This part doesn't matter a whole lot, but is a good step none-the-less.
  9. Now the fun part -- go to File -> Automate -> Batch, and choose the Actions folder that you created a moment ago.
    1. Select your source and destination folders (should be different).
    2. Override "Open" commands, and "Save As" actions.
  10. Click ok, and have some coffee.

It really is a very easy process, especially after you get the hang of it. There is a lot of information on Google about automating things in Photoshop, also.

| improve this answer | |
  • Thanks for the great guide! Personally went for the imagemagick approach as it doesn't require all the initial setup and possibility of mistakes. It would be nice if Photoshop shipped with such a simple and likely action! – CMash Sep 16 '16 at 13:09

Here is step by step guide inspired from bassplayer7

How to trim multiple images in Photoshop http://tech-with-us.blogspot.com/2016/12/how-to-trim-multiple-images-in-photoshop.html

| improve this answer | |
  • Welcome to Ask Different! We're trying to find the best answers and those answers will provide info as to why they're the best. Explain why you think the link you provided will answer the question. Links can change and become outdated so we prefer the answers to not just be a link. See How to Answer on how to provide a quality answer. – fsb Dec 10 '16 at 18:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .