npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

photoshopjs-core

v0.1.0-dev.4

Published

(work in progress)

Downloads

5

Readme

photoshopjs-core

[Might become] a Photoshop scripting library.

What's the story?

I was developing a couple of Photoshop panels like this:

Screenshot of Array Photoshop Panel

... and I was using Photoshop's ExtendScript api. Soon I realized the ExtendScript DOM lacks features and is not easy to work with. So I came up with a library that wraps around Photoshop's own api and gives a jQuery-like interface, like this:

// get the active layer
_('active')
// move a quarter of the document's width to the right
.moveX(_.doc.width / 4)
// rotate 45 degrees around it's top/left
.rotate(45, 'topleft')

That library worked and we developed a few panels based on it, but it was too slow, because apparently the ExtendScript DOM is slow. In big documents, every single operation on each layer could take up to a second, and if you have many operations on many layers, the whole thing would take minutes which is not acceptable.

So I scratched the whole thing and decided to write our panels with ActionDescriptors that look like this:

var idMk = charIDToTypeID( "Mk  " );
    var desc7 = new ActionDescriptor();
    var idNw = charIDToTypeID( "Nw  " );
        var desc8 = new ActionDescriptor();
        var idPstn = charIDToTypeID( "Pstn" );
        var idPxl = charIDToTypeID( "#Pxl" );
        desc8.putUnitDouble( idPstn, idPxl, 176.911544 );
        var idOrnt = charIDToTypeID( "Ornt" );
        var idOrnt = charIDToTypeID( "Ornt" );
        var idVrtc = charIDToTypeID( "Vrtc" );
        desc8.putEnumerated( idOrnt, idOrnt, idVrtc );
    var idGd = charIDToTypeID( "Gd  " );
    desc7.putObject( idNw, idGd, desc8 );
executeAction( idMk, desc7, DialogModes.NO );

ActionDescriptors can be fast, but they don't read well, they're not well-documented, and afaik, they're not easy to debug.

So now, the DOM is slow and the ActionDescriptors are too complicated. The middle-ground would be to create a wrapper around ActionDescriptors with a simpler api, which is where this project is at this point.

We'll be developing more Photoshop panels and that will make me add more features to this project. Chances are that at some point this project gets stable enough that I'll be able to advertize it as "A Photoshop scripting library," remove this story and write up some real docs :)

Projects using photoshopjs-core

  • Griddify - A Photoshop panel to make guides and grids.
  • More to come

License

MIT