ComfyUI Node

MarkImageNode

The point-pairing canvas that makes reference following precise

By smthemex·Created 2 years ago·Updated about a year ago· 58
MarkImageNode
    • image
    • xy_data
    markimage_imagecanvas_image.png
    trigger0

    MarkImageNode is the "precise" in "Line Art Colorization with Precise Reference Following." MangaNinjiaSampler will happily colorize line art from a reference image, but on its own it only knows the reference exists - it doesn't know what goes where. This node fixes that with the most low-tech high-impact tool in the pack: a canvas you click on.

    You place two of these in a workflow. One sits on your reference image, one on your line art. On each you click corresponding points - a dot on the character's hair in the reference, a dot on the same hair in the line art, and so on for the colors you care about. The node bundles those clicks into a list the sampler uses to lock the correspondence. Want the scarf red because the reference scarf is red? Click both scarves. Skip the clicks and you lose the precision that makes this whole thing different from a generic img2img color pass.

    How it works

    The node is mostly a front-end trick. The pack ships a custom JavaScript widget (in its js/ folder) that draws an interactive canvas over your image. When you click, the points are POSTed to a custom route the node registers on ComfyUI's server (/api/upload/clickedPoints), keyed by the name of the canvas file. On execution, MarkImageNode loads that saved canvas back off disk, passes it through as an IMAGE, and converts the click data into a sorted list of [x, y] coordinates - that's your MINJIA_DATA.

    Two things follow from that design. The canvas has to actually be saved before you run, and because points are looked up by filename, the filenames have to be distinct.

    Inputs and outputs

    • markimage_image - a STRING, default "canvas_image.png". This is the name of the canvas file inside ComfyUI/input/ that the widget writes. Set it before you start clicking.
    • trigger - an INT that's hidden in the UI. Bump it when the node isn't re-running; it's the "please refresh me" handle.

    Outputs: image (the canvas as an IMAGE, preview it or wire it on) and xy_data (type MINJIA_DATA). In the reference node's case, image feeds the sampler's image input and xy_data feeds xy_data_ref; the lineart node's outputs feed lineart_image and xy_data_lineart.

    Install and gotchas

    No extra models - the whole cost of this pack is in the loader and sampler. Install once via ComfyUI Manager (search "MangaNinjia") or git clone https://github.com/smthemex/ComfyUI_MangaNinjia into ComfyUI/custom_nodes, restart, done.

    The README's update note is the one trap worth remembering, and it's a doozy: the two canvases must have different filenames. The server keys your clicked points by the basename of the canvas file, so if both nodes save as canvas_image.png, one overwrites the other's points and your correspondence silently mixes up. Name them canvas_image.png and canvas_image_1.png (or anything distinct) and keep them different. The author also asks you to run their JSON workflow rather than rebuilding from scratch, because the filename wiring is easy to get wrong by hand.

    Sparse helper nodes like this never show up in the search stats the way samplers do, but it's the difference between "colorized" and "colorized correctly." Don't skip the clicks.

    CategoryMangaNinjia

    Inputs (2)

    NameTypeDefaultDescription
    markimage_imageSTRINGcanvas_image.png
    triggerINT00–99999999

    Outputs (2)

    NameTypeDescription
    imageIMAGE
    xy_dataMINJIA_DATA