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

Here is how you actually use this in your code. The library handles the math so you don't have to

Just open and save

If you want the easy way, just use open and save

import wimf

# open a file and get a WIMFImage object
img = wimf.open("photo.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
cv_img = img.to_opencv()

Quick metadata check

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

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

Metadata Surgery

If you want to fix an author name or tag without re-encoding 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'] = "New Author"
    meta['project'] = "VFX Render"
# file is updated when you exit the with block

Clone this wiki locally