RoundNumberPixelsSelect ps logo002Round Number Pixels Select is a new Photoshop panel to help you resize the selection border horizontally and vertically to “round” numbers, i.e. multiples of a preferred number of pixels (e.g. multiples of powers of 2 such as 8, 16, 32) before cropping an image, to get more convenient dimensions (e.g. an integer number of JPEG blocks).

I designed this panel to automate one of my habits, that is, whenever I digitalize old silver photographs or various papers, while I select in Photoshop the aeras to crop from a full-platen scan of e.g. an album page, I usually manage if possible to get dimensions multiple of 8 pixels, or even 16, 32 or more (sometimes refered to as dimensions or resolutions “mod8”, “mod16”, “mod32”, etc.), like photos from digital cameras, that has a few advantages (possibility of later cleaner downscaling to 50%, 25% or 12.5%, of lossless JPEG transformations, etc. cf. https://stackoverflow.com/q/74892/8678084). Since the scanned resolution is pretty high, the bounds of each picture to crop are generally not precise to the pixel, allowing some liberty in defining the aera to crop, and for example if I selected freehand a rectangle of 2047 x 1537 px following approximately the bounds of a photo, I generally prefer to round it after to 2048 x 1536 px.

So this panel is designed to help you modify the width and height of a rectangular selection in Photoshop so that they be multiple of a given value, in pixels or even in another of the available measurement units that can be selected from the application preferences.

RoundNumberPixelsSelect ps006 demo001en

Starting with an existing selection[1], you can expand or contract, to the nearest multiple of the typed value (in the application ruler measurement unit), the width and/or the height of the selection border or another of the few options from the dropdown menu:

  • “selection border”: results in a rectangular selection area. Every use of the “expand” or “contract” button results in a new “Lasso” step in the History panel[2].
  • “crop border”: same as “selection border” but switching to Crop tool to show a preview of the cropped result. The crop border can extend beyond the canvas size if you uncheck the “restrict selection to canvas” checkbox.
  • “mask”: same as “selection border” but switching to the Mask mode (additional visible step in the History panel) to show a preview of the cropped result.
  • “canvas size”: expand or contract the canvas size of the document (regardless of the selection).

After expanding/contracting the selection rectangle (whose dimensions are then displayed in green if they are actually multiple), you can use the “crop selection” button, that is quite the same as using the «Image > Crop» menu of the application (except that in case of selection rectangle extending beyond the canvas, the “crop selection” button will keep the selection outer area as well).

[1] or even without any selection, the panel will then react as if you selected a single pixel localized according to the reference point before using the “expand” button, or as if you selected the whole canvas before using the “contract” button.

[2] consequence of the use of the function http://jongware.mit.edu/pscs5js_html/psjscs5/pc_Selection.html#select.

Add comment

Follow Scriptopedia to Social Network

Scriptopedia sur facebook

About Scriptopedia.org

An original idea from Loic Aigon, designed by Eddy.VH. It 's a scripts library for Desktop Publishing Adobe products. Find Javascript for Photoshop, Illustrator, inDesign and Acrobat or ATN scripts ( Photoshop actions ) you need.