| 1 | # Command-line tool to convert images |
| 2 | |
| 3 | Convert one image into another. |
| 4 | Can resize the image and adjust colors. Syntax: |
| 5 | |
| 6 | ``` |
| 7 | image_convert <inputfile> <outputfile> [<resize-x> <resize-y>] |
| 8 | ``` |
| 9 | |
| 10 | This will convert image in `<inputfile>` to image in `<outputfile>`. |
| 11 | Format of both images will be recognized from file extension. |
| 12 | `<inputfile>` and `<outputfile>` may be the same file, it will be handled OK. |
| 13 | |
| 14 | If optional `<resize-x>` `<resize-y>` parameters are given then output image |
| 15 | is scaled to that size. Size = 0 means "do not scale in this dimension", |
| 16 | e.g. `<resize-x> <resize-y>` = 200 0 means "scale x dimension to 200 |
| 17 | and leave y dimension as is". (effectively, specifying |
| 18 | `<resize-x> <resize-y>` = 0 0 has the same effect as omitting these |
| 19 | parameters). |
| 20 | |
| 21 | Additional parameters (use them anywhere, before or after, main parameters documented above): |
| 22 | |
| 23 | - `-s <float>` or `--scale <float>` |
| 24 | |
| 25 | Valid only if input file has a float format (this is currently |
| 26 | the case only for RGBE (Radiance) image format). |
| 27 | |
| 28 | Effect : before writing output image, scales each pixel color |
| 29 | (its red, green and blue value) by <float>. |
| 30 | Multiple --scale *cummulate* : e.g. |
| 31 | "--scale 1.5 --scale 2" would have the same effect as |
| 32 | "--scale 3". |
| 33 | |
| 34 | |
| 35 | - `-g <float>` or `--gamma <float>` |
| 36 | |
| 37 | Similiar to `--scale` - valid only when input has float precision, |
| 38 | multiple params are cummulated, default is 1.0. |
| 39 | |
| 40 | Each component is raised to 1/<float>. |
| 41 | |
| 42 | - `--grayscale` |
| 43 | |
| 44 | Convert to grayscale. |
| 45 | |
| 46 | - `--convert-to-channel 0|1|2` |
| 47 | |
| 48 | Converts colors to red / green / blue channel, |
| 49 | its like converting to grayscale and then |
| 50 | writing output to only one channel. |
| 51 | |
| 52 | - `--strip-to-channel 0|1|2` |
| 53 | |
| 54 | Strips colors to only one channel, i.e. |
| 55 | sets to zero intensities of other two channels. |
| 56 | |
| 57 | Using [Castle Game Engine](https://castle-engine.io/). |
| 58 | |
| 59 | ## Building |
| 60 | |
| 61 | Compile by: |
| 62 | |
| 63 | - [CGE editor](https://castle-engine.io/editor). Just use menu items _"Compile"_ or _"Compile And Run"_. |
| 64 | |
| 65 | - Or use [CGE command-line build tool](https://castle-engine.io/build_tool). Run `castle-engine compile` in this directory. |
| 66 | |
| 67 | - Or use [Lazarus](https://www.lazarus-ide.org/). Open in Lazarus `x3d_call_pascal_code_standalone.lpi` file and compile / run from Lazarus. Make sure to first register [CGE Lazarus packages](https://castle-engine.io/lazarus). |