|
2 | 2 |
|
3 | 3 | 
|
4 | 4 |
|
5 |
| -From given maximum dimensions, divide an input image into multiples crops. |
| 5 | +Divide an image into multiple crops so it can be recombined later. This has some |
| 6 | +usefulness in the context of some nuke versions ... |
6 | 7 |
|
7 | 8 | 
|
8 | 9 |
|
9 |
| -Compatible with: |
10 |
| -- Nuke Non-Commercial |
11 |
| -- Python > 2.7 |
12 |
| -- Windows, Mac |
| 10 | +# requires |
13 | 11 |
|
14 |
| -# Use |
| 12 | +- Nuke or Nuke Non-Commercial |
| 13 | +- Nuke with Python >= 2.7 |
| 14 | +- All OS should be supported but was only tested on Windows. |
15 | 15 |
|
16 |
| -The most straightforward setup is to paste/insert the [node.nk](node.nk) node |
17 |
| -into your nuke script, setup it and execute the script button. |
| 16 | +The combine feature requires `oiiotool` or `Pillow` to be availble on the |
| 17 | +system. See below for more information. |
| 18 | + |
| 19 | +# Usage |
| 20 | + |
| 21 | +- Copy/paste the content of [ImageCropDivide.nk](ImageCropDivide.nk) in Nuke. |
18 | 22 |
|
19 | 23 | 
|
20 | 24 |
|
21 |
| -- Set the desired max dimensions and your source size. |
| 25 | +- Set the desired max dimensions and your source size if the defaults are not expected. |
| 26 | +- `Export Directory`: Set where the directory where the crops must be exported |
| 27 | +- `Combined File Name`: if you use the combine feature, name without the extension, of the combined file. |
22 | 28 | - Click the `Copy ...` button
|
23 | 29 | - press ctrl+v to paste the node setup in the nodegraph.
|
24 |
| -- On any of the Write node, modify the settings for export. |
| 30 | +- connect the top write node to the same node as the imageCropDivide node |
| 31 | +- On any of the cloned Write node, modify the settings for export as desired. |
25 | 32 | - Unclone all the Write nodes `(Alt + shift + K)`
|
| 33 | +- Render all the Write nodes |
| 34 | +- Once finished you have the option to combine the exported crops. See below |
| 35 | +for details. |
| 36 | + |
| 37 | +> [!WARNING] |
| 38 | +> it seems that changing the file type of cloned write node make nuke crash |
| 39 | +> so you might have to unclone first and propagate changes on all write nodes :/ |
| 40 | +
|
| 41 | +# combining |
| 42 | + |
| 43 | +Combining will find ALL images in the `Export Directory` and combine them to |
| 44 | +a single image named using `Combined File Name` knob value. |
| 45 | + |
| 46 | +> [!WARNING] |
| 47 | +> make sure the `Export Directory` doesn't contain anything else than |
| 48 | +> the crop you just exported before combining. |
| 49 | +
|
| 50 | +Combining require external softwares. Different options are available and |
| 51 | +automatically detected. |
| 52 | + |
| 53 | +Here are the option in their order of priority : |
| 54 | + |
| 55 | +## oiiotool |
| 56 | + |
| 57 | +Recommended option. Use the `oiiotool.exe` CLI from OpenImageIO to combine back the crops. |
| 58 | + |
| 59 | +You can specify the path to the oiiotool executable in 2 ways : |
| 60 | +- environment variable `OIIOTOOL` |
| 61 | +- the `oiiotool path` knob on the node |
| 62 | + |
| 63 | +> [!TIP] |
| 64 | +> You can find it in the Arnold render-engine installation like |
| 65 | +> `C:\Program Files\Autodesk\Arnold\maya{VERSION}\bin` |
| 66 | +> |
| 67 | +> Or alternatively [get it from here](https://www.patreon.com/posts/openimageio-oiio-63609827) (has more plugin support) |
| 68 | +
|
| 69 | + |
| 70 | +## Pillow |
| 71 | + |
| 72 | +A python library for image processing. It work for simple case but suck |
| 73 | +for anything else (anything not 8bit). |
| 74 | + |
| 75 | +It simply requires Pillow to be importable in the python context (`from PIL import Image`). |
| 76 | + |
| 77 | + |
| 78 | +# faq |
| 79 | + |
| 80 | +> Why is there a ModifyMetadata node ? |
| 81 | +
|
| 82 | +This is the only way I found for now to have a different suffix per Write |
| 83 | +node and have them cloned at start. I could remove them and set directly the |
| 84 | +suffix on each unique Write node but then it would be a pain to modify one setting |
| 85 | +on all the write nodes. |
| 86 | + |
| 87 | +# Developer |
| 88 | + |
| 89 | +Instructions to develop the node. |
| 90 | + |
| 91 | +[ImageCropDivide.nk](ImageCropDivide.nk) is the result of a build process defined |
| 92 | +in [src/](src). |
| 93 | + |
| 94 | +It consist of combining nk file templates (because they have variables) with |
| 95 | +python scripts to form a single `.nk` node. |
| 96 | + |
| 97 | +To build the node simply execute [build.py](src/build.py) from any python 3 |
| 98 | +interpreter. |
| 99 | + |
| 100 | +File suffixed with `-template` contained variable replaced during build. |
| 101 | +Variables have the syntax `%VARIABLE_NAME%`. |
26 | 102 |
|
27 |
| -_Why is there a ModifyMetadata node ?_ |
28 |
| -> This is the only way I found for now to have a different suffix per Write |
29 |
| -> node and have them cloned at start. I could remove them and set directly the |
30 |
| -> suffix on each unique Write node but then it would be a pain to modify one setting |
31 |
| -> on all the write nodes. |
32 | 103 |
|
33 | 104 | # Licensing
|
34 | 105 |
|
|
0 commit comments