Skip to content

Conversation

@wjt
Copy link
Contributor

@wjt wjt commented Sep 23, 2025

Piskel is a browser-based sprite editor. Its file format is JSON-based (though the JSON contains base64-encoded PNG data).

Recognise the .piskel extension and identify it analogously to .svg: it is text, image, json and piskel.

https://github.com/piskelapp/piskel
http://justsolve.archiveteam.org/wiki/Piskel_canvas

wjt added a commit to endlessm/threadbare that referenced this pull request Sep 23, 2025
Like SVGs, these are stored as plain text, but are not meant to be hand-edited.

The “identify” library doesn't recognise *.piskel files as images. Match
them by filename.

I submitted pre-commit/identify#541 to teach
identify about these files; if that change is accepted and released this
could be reverted.
'php4': {'text', 'php'},
'php5': {'text', 'php'},
'phtml': {'text', 'php'},
'piskel': {'text', 'image', 'piskel', 'json'},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the image tag was an idea that didn't really pan out so I'm just going to remove it here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a shame, because in this case the image tag is just what we want!

Piskel is a browser-based sprite editor. Its file format is JSON-based
(though the JSON contains base64-encoded PNG data).

Recognise the .piskel extension and identify it analogously to .svg: it
is text, image, json and piskel.

https://github.com/piskelapp/piskel
http://justsolve.archiveteam.org/wiki/Piskel_canvas
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asottile asottile enabled auto-merge October 2, 2025 17:42
@asottile asottile merged commit 05b2674 into pre-commit:main Oct 2, 2025
6 checks passed
@wjt wjt deleted the piskel branch October 2, 2025 18:03
wjt added a commit to endlessm/threadbare that referenced this pull request Oct 3, 2025
My upstream pull request was merged:

- pre-commit/identify#541

The maintainer chose to edit my contribution to not add the `image` tag
to piskel files:

> the `image` tag was an idea that didn't really pan out so I'm just
> going to remove it here

Of course that's their prerogative as maintainer!

Unfortunately this means that my plan from commit
e92fd6d, to exclude all image files
with `exclude_types: [image]`, is not going to work. Instead we have to
add the `piskel` type explicitly to the list, and also any further
text-based image file formats that we find in future.

Add `piskel` to the exclude list. Replace the `image` type with `svg`:
`svg` is the only format with that type, and since that tag will not be
applied to any new formats, it's clearer to be explicit.

Remove the regex branches that match piskel files by name.

If you have `pre-commit` set up locally, this change will cause the hook
to fail:

    =====> Type tag 'piskel' is not recognized.  Try upgrading identify and pre-commit?

If you installed `pre-commit` with `uv tool install` you can run:

    uv tool upgrade pre-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants