The Ultimate Photoshop Brush Creator

This page provides one definitive script to fix the "file not compatible" error and automate your entire brush creation process—including interactive resizing.

The Ultimate Exporter Script

This is the only script you need. It's powerful, user-friendly, and creates highly compatible brush files. It prompts for a folder, a resize dimension (px), and a final filename.

Universal Brush Exporter Script (Corrected)

Copy this code and follow the guide below. It will run perfectly in Photoshop.

#target photoshop

function main() {
    // --- START OF USER SETTINGS ---

    // Set your desired MAXIMUM dimension in pixels. The script will ensure the longest
    // side of any image (width or height) is resized to this value,
    // while the other side scales down proportionally to prevent distortion.
    var maxDimension = Number(prompt("Step 2: Enter max brush dimension in pixels (e.g., 2500)", 2500));

    // --- END OF USER SETTINGS ---


    var sourceFolder = Folder.selectDialog("Select the folder with PNG files to convert");
    if (!sourceFolder) {
        return; // User cancelled
    }

    var fileList = sourceFolder.getFiles(/\.(png)$/i);

    if (fileList.length === 0) {
        alert("No PNG files were found in the selected folder.");
        return;
    }

    for (var i = 0; i < fileList.length; i++) {
        var doc = open(fileList[i]);
        var docName = doc.name.replace(/\.[^\.]+$/, '');

        // --- Smart Resizing Logic ---
        var originalWidth = doc.width.as('px');
        var originalHeight = doc.height.as('px');
        var newWidth, newHeight;

        if (originalWidth > originalHeight) { // Image is landscape
            newWidth = maxDimension;
            // Calculate new height based on original aspect ratio
            newHeight = originalHeight * (maxDimension / originalWidth);
        } else { // Image is portrait or square
            newHeight = maxDimension;
            // Calculate new width based on original aspect ratio
            newWidth = originalWidth * (maxDimension / originalHeight);
        }

        // Resize the image using the calculated, non-distorted dimensions
        doc.resizeImage(UnitValue(newWidth, 'px'), UnitValue(newHeight, 'px'), null, ResampleMethod.AUTOMATIC);

        // --- Define Brush ---
        app.activeDocument.selection.selectAll();
        var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putClass(charIDToTypeID("Brsh"));
        desc.putReference(charIDToTypeID("null"), ref);
        var ref1 = new ActionReference();
        ref1.putProperty(charIDToTypeID("Prpr"), charIDToTypeID("fsel"));
        ref1.putEnumerated(charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
        desc.putReference(charIDToTypeID("Usng"), ref1);
        desc.putString(charIDToTypeID("Nm  "), docName);
        executeAction(charIDToTypeID("Mk  "), desc, DialogModes.NO);

        doc.close(SaveOptions.DONOTSAVECHANGES);
    }

    alert(fileList.length + " brushes created successfully at a max dimension of " + maxDimension + "px.");
}

main();
                        

How to Use the Script

1

Copy the Script Code

Click the "Copy" button in the corner of the code block above to copy the entire script to your clipboard.

2

Save the Script File

Open a plain text editor (like Notepad on Windows, or TextEdit on Mac). Paste the code and save the file with a `CreatorNMHRUBYBrushes.jsx` extension.

3

Install the Script in Photoshop

Place the saved `CreatorNMHRUBYBrushes.jsx` file into your Photoshop Scripts folder. Then, restart Photoshop.

  • Windows: `C:\Program Files\Adobe\Adobe Photoshop [Version]\Presets\Scripts\`
  • Mac: `/Applications/Adobe Photoshop [Version]/Presets\Scripts/`
4

Run and Follow Prompts

In Photoshop, go to `File > Scripts >` and click on your script (`CreatorNMHRUBYBrushes`). Follow the three on-screen prompts. Your compatible `.ABR` file will be saved directly to your Desktop.