Skip to content
This repository was archived by the owner on Jul 10, 2026. It is now read-only.

Developer Integration

arrow edited this page Jun 6, 2026 · 4 revisions

Developer Integration

So you actually want to use this in your code? idk why but here is how you do it. This library is basically "god mode" for images if you can ignore the fact that nothing else opens these files

Just open and save (The easy way)

If you aren't trying to be a hero, just use open and save

import wimf

# open a file and get a WIMFImage object
img = wimf.open("secret_stash.wimf")

# look at it using PIL
img.pil.show()

# save it back
wimf.save("copy.wimf", img.pil, quality=8)

Making it work with real stuff

If you do ML or actual work, you probably need arrays. We got you.

# get a normal numpy array
arr = img.to_numpy()

# get an opencv bgr array because opencv is special
cv_img = img.to_opencv()

Quick metadata check

If you just want to see who made the file without loading 50MB of pixels:

info = wimf.info("some_file.wimf")
print(info['author'])

Fixing typos (Metadata Surgery)

If you fucked up the author name and don't want to re-encode the whole giant image, use this. It just swaps the JSON text in the file

with wimf.edit_meta("huge_file.wimf") as meta:
    meta['author'] = "Not a Hacker"
    meta['comment'] = "i fixed it"
# file is updated when you exit the with block. magic.

Clone this wiki locally