Skip to content

Update JIMP#2171

Merged
GCHQDeveloper581 merged 25 commits intogchq:masterfrom
C85297:update-jimp
Feb 18, 2026
Merged

Update JIMP#2171
GCHQDeveloper581 merged 25 commits intogchq:masterfrom
C85297:update-jimp

Conversation

@C85297
Copy link
Member

@C85297 C85297 commented Feb 3, 2026

No description provided.

@C85297 C85297 self-assigned this Feb 3, 2026
@C85297 C85297 added the dependencies Pull requests that update a dependency file label Feb 3, 2026
@GCHQDeveloper581
Copy link
Contributor

I think your error may be related to what I was looking at in https://github.com/GCHQDeveloper581/CyberChef/tree/fix-issue-XXXX

@GCHQDeveloper581
Copy link
Contributor

Actually looking harder at the error returned, I think it's another issue I've (also previously) encountered with the root cause being that some Operations return a Value and others return a Promise. In the normal browser this seems to work out OK but when running under node it creates an issue.

@C85297
Copy link
Member Author

C85297 commented Feb 5, 2026

So I worked out the error was this:

    at Object.p [as next] (http://localhost:8000/modules/Image.js:2:1023389)
    at S (http://localhost:8000/modules/Image.js:2:1024030)
    at http://localhost:8000/modules/Image.js:2:1024950
    at transpile (http://localhost:8000/modules/Image.js:2:1024969)
    at convertXML (http://localhost:8000/modules/Image.js:2:1025103)
    at loadBitmapFontData (http://localhost:8000/modules/Image.js:2:1026062)
    at async loadFont (http://localhost:8000/modules/Image.js:2:1027310))" (1ms)

Which was caused by Jimp attempting to load the font file as XML (which it wasn't). It seems Jimp used to support BMFont text files, but now only supports BMFont XML files.

I created a simple program using bmfont_rs to convert the files to XML:

fn main() -> bmfont_rs::Result<()> {
    for fnt_in_fname in std::env::args().skip(1) {
        let fnt_in_path = std::path::PathBuf::from(&fnt_in_fname);
        let fnt = bmfont_rs::text::from_bytes(&std::fs::read(&fnt_in_path)?)?;
        let fnt_out_path = fnt_in_path
            .with_extension("")
            .with_added_extension("fnt")
            .with_added_extension("xml");
        std::fs::write(&fnt_out_path, bmfont_rs::xml::to_vec(&fnt)?)?;
        println!("{:?} -> {:?}", fnt_in_path, fnt_out_path);
    }
    Ok(())
}

As the font files had incorrect negative spacing values, I had to remove the signs on these and re-add them on the outputted XML files.

@C85297
Copy link
Member Author

C85297 commented Feb 5, 2026

The output of Add Text To Image has slightly changed.

Previously:
image

Now:
image

Although in this case it looks correct testing on a larger image shows the alignment is broken:

Previously:
image

Now:
image

Copy link
Contributor

@GCHQDeveloper581 GCHQDeveloper581 left a comment

Choose a reason for hiding this comment

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

A couple of observations which I'd like explicit confirmation are intended/investigated before approving.

@GCHQDeveloper581 GCHQDeveloper581 merged commit c97baa6 into gchq:master Feb 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments