3

I'm looking for a way to add a 3 pixel black border to every file in a folder. File type is .jpg.

My OS's are Ubuntu 14.04, Ubuntu 15.10, and Windows 7.

6 Answers 6

4

ImageMagick

  • works on Windows and several other OS, but I could not find a DEB file for Ubuntu
  • is free, even for commercial use
  • can add all kinds of borders
  • supports many formats and can convert between them if needed

It's a command line utility which is very suitable for batch processing of many files without user interaction.

2

You can use gimp on batch mode over all files in folder and run gimp scripts for visual effects like this one for borders.

1
  • Would you mind posting an example command that would achieve this? That would make it a better quality answer. Thanks!
    – Nicolas Raoul
    Commented Aug 30, 2016 at 4:05
2

IrfanView works well for me for sets of images. Here are some how-to notes

Here is my stored procedure for border insertion - Infran Procedure to add a border

  1. Right-Click image, 'Open with'->'InfranView'
  2. Press 'b'
  3. Check 'Use advanced options' in upper left, press 'Advanced'
  4. Check 'Canvas Size', press 'Settings'
  5. Enter each border width(Left side, Right side, Top side, Bottom side)
  6. Press 'OK'
  7. Select 'Overwrite existing files'
  8. Press 'OK'
  9. Enter the output directory 'Output directory for result files:'
  10. Navigate to and double click the image to add border to in upper list. This adds it to the 'input files:' listing at bottom list
  11. Press 'Start Batch'
1

gnuThumbnailer supports Windows and Linux. It is primarily for creating thumbnails of images but has an option for adding borders to images. This option would probably only work if your images are the same size.

0

One online tool to add borders to images in bulk is available:

https://supertool.org/image-picture-photo-borders/

You can upload multiple files, choose border color, add up to two borders, and adjust border size. The borders adjust proportionally to image size in the batch you want to process. This latter part doesn't fit the exact request here, but is useful if you have a batch of different sized images. That is, w/ a border of 3px, a large image that is 5000x5000 will end up with a small border vs. a small image that is 25x25 will end up with a proportionately larger border. The advantage with this tool is that you set the border size relative to each image and so the border size scales well.

0

You can use ImageMagick for that. It run on macOS, Linux and Windows. The command to add a 3-pixel black border on all sides to all JPEGs in the current directory is:

magick mogrify -bordercolor black -border 3 *.jpg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.