Node

If you install a node package and it does not appear in any of the .../lib directories and is not available on $PATH, try installing it globally.

I experienced this issue with web-ext when I was setting up my environment to build Firefox extensions. I had wanted to install web-ext just to that project’s directory because it relies on obsolete packages. However, it would not install to my project’s directory.
Solution Example:

npm install --global web-ext

Applescript

Resize Images

If you want to quickly resize images natively, this applescript by stackoverflow user regulus6633 still works in 2023. Assumes that files that need to be resized have filenames that end in a specific string.

Here’s an applescript way. Save this code as an application. You can then 1) drop images on it or 2) double-click it and choose a file. It has code to verify that the dropped file has @2x in its name. If so it scales it and if not nothing happens. I see you already have a solution but I wanted to show applescript has the application “Image Events” which can easily scale an image. Good luck.

property theSeparator : "@2x"
property scaleFactor : 0.5

on run
    set f to choose file
    processTheFiles({f})
end run

on open theFiles
    processTheFiles(theFiles)
end open

on processTheFiles(theFiles)
    tell application "Image Events" to launch
    repeat with f in theFiles
        set thisFile to f as text
        if thisFile contains theSeparator then
            set savePath to text 1 thru -8 of thisFile & text -4 thru -1 of thisFile
            tell application "Image Events"
                set a to open f
                scale a by factor scaleFactor
                save a in savePath
            end tell
            delay 0.2
        end if
    end repeat
    tell application "Image Events" to quit
end processTheFiles
regulus6633

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *