I'm trying to resize a bunch of images (see below) for use in an educational resource (university outreach).

Because of the way the images are generated (unavoidably), they are always 1024 x 768 px (the size of the application window) which means that once cropped the structures within each image are vastly different sizes. What I am trying to achieve is to standardise the images such that each atom (circle) is consistently the same size between the various images.

My current workaround is to draw a square over the nearest grey atom (circle) in photoshop, take the dimensions of that square, and then scale the whole image so that the square is exactly 100 x 100 px.


What I'd ideally like is to be able to have this process 'automated' - not completely automated, as I'll clearly always need to choose the atom I want to resize. Basically, a way of just drawing one square around the atom (marquee select) and then being able to tell the software that I want that selection to be 100 x 100 px.

I have access to Adobe CC, and additionally Affinity Designer/Photo, but do have the budget to acquire other software if there's something that fits the bill and works on a Mac.

3 Answers 3


Assuming you want the image to scale uniformly then you can use this script:

#target photoshop

  #target photoshop

targetwidth = 100;
var doc = app.activeDocument;
var width = getSize()[0];
var ratio = UnitValue(1/(width/targetwidth).value * 100, "%");

////// support functions /////

function getSize() {
   var bound = doc.selection.bounds;
   return [
     bound[2] - bound[0],
     bound[3] - bound[1]

Note the script only cares of your selection width.

  • so to clarify, the OP would select the atom, and then run this script? Should there be test for the existence of a selection first?
    – Yorik
    Aug 1, 2018 at 14:28
  • @Yorik then the bounds will be 0 and the division will fail. So no harm there. Seems like i dont actually have to make the layer though. Old script.
    – joojaa
    Aug 1, 2018 at 14:32

I'm not entirely sure I follow what you are trying to do, but you can set the Crop Tool to a specific width and height in pixels (leaving the resolution field blank).

enter image description here

Then when you crop, it will be resized to the dimensions entered.


In my opinion, this should nob e automatized. This is a case where you have potentially a wide range of molecules shapes, compositions, and dimensions, so you need some flexibility to optically and visually set the dimensions.

It is not the same a molecule of 3 atoms that one of 100.

But also you have different 3Dimensional rotations and planes.

A mechanical approach in my opinion is not the best way to do this.

Sayed that, I just do it using a transparent layer as a reference, and just visually scaling the other molecule.

But I would NOT use Photoshop because you will be potentially resampling the image, blurring it.

I would use a vector based program, like Corel Draw, Affinity Designer, Illustrator, or the program you are using to assemble it. Indesign, or even word. The point is to leave the original resolution intact to maximize the quality of the images.

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.