developers
code.
not clicks.
HM GUI ships as two engines that share one recipe format: hmcore for
Python and HMCoreKit for iOS 17+ and macOS 14+. Access is by license.
python.
import hmcore as hm from hmcore import retouch img = hm.load_image("guest.heic") out, recipe = retouch.auto_portrait(img, level="natural") hm.save(out, "guest.jpg") # 8-bit in, 8-bit out recipe.save("guest.json") # every step, editable preview = recipe.apply(img, preview=1170) # screen size
swift.
import HMCoreKit let img = try HMImage.load(url: photoURL) let recipe = try Recipe.load(recipeURL) let preview = try MetalRenderer() .apply(recipe, to: img) // GPU try recipe.apply(img) .write(url: outURL, bitDepth: 16) // ICC embedded
the recipe.
Steps run in order, and parameters are the op's own. Masks travel inside a recipe as lossless 16-bit PNG, and local edits, liquify and face data are part of the format. Automatic tools store their results as numbers, so a replay never has to guess.
// look.json: made on the Mac, replayed on iPhone, identical { "hm_recipe": 1, "name": "HM Portrait (natural)", "steps": [ { "op": "spot_heal", "points": [[812, 640, 9]] }, { "op": "smooth_skin", "strength": 0.35, "texture": 0.5 }, { "op": "enhance_eyes", "strength": 0.25 }, { "op": "white_balance", "temperature": 5600 }, { "op": "curves", "points": [[0,0],[.5,.56],[1,1]] } ] }
command line.
hm retouch portrait guest.jpg out.jpg --save-recipe steps.json hm retouch heal in.tif out.tif --points 812,640,9 hm bg replace in.jpg out.psd --background studio.tif --kind person hm crop in.jpg out.jpg --aspect print_4x6 --auto --straighten hm edit in.heic out.tif -r look.json --bit-depth 16 hm models verify
proof.
From the test suites, run on every change.
| check | target | measured |
|---|---|---|
| Swift vs Python, 42 golden cases (CPU and GPU) | ΔE2000 mean < 1.0, p99 < 3.0 | worst mean 0.08, typical 0.001 |
| content-aware fill vs diffusion fill | +3 dB PSNR | +15.6 dB |
| hair-fringe cut-out | alpha MSE < 0.02 | 0.006 |
| 12 MP one-tap portrait (Python, Apple Silicon) | < 3 s | 1.2 s |
| GPU preview frame, 1170×1560 | < 33 ms | 13 ms |
| auto straighten | < 0.3° | ≤ 0.05° |