D bindings to the GraphicsMagick library.
Revisão | cd39ae189cac7a49259f30d4ce0e11ddaf2f0b66 (tree) |
---|---|
Hora | 2023-07-04 11:04:26 |
Autor | Mio <stigma@disr...> |
Commiter | Mio |
[examples] Update convert.d
@@ -21,26 +21,30 @@ | ||
21 | 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 | 22 | SOFTWARE. |
23 | 23 | */ |
24 | +import std.path : extension; | |
24 | 25 | import std.stdio; |
25 | 26 | |
26 | 27 | import magickd; |
27 | 28 | |
28 | 29 | int main(string[] args) { |
29 | - if (args.length != 3) { | |
30 | - stderr.writefln("Usage: %s <infile> <outfile>", args[0]); | |
31 | - return 1; | |
32 | - } | |
30 | + if (args.length != 3) { | |
31 | + stderr.writefln("Usage: %s <infile> <outfile>", args[0]); | |
32 | + return 1; | |
33 | + } | |
33 | 34 | |
34 | - initializeMagick(); | |
35 | - scope(exit) destroyMagick(); | |
35 | + InitializeMagick(null); | |
36 | + scope(exit) DestroyMagick(); | |
36 | 37 | |
37 | - MagickWand wand = MagickWand.create(); | |
38 | - wand.readImage(args[1]); | |
38 | + MagickWand wand = MagickWand.create(); | |
39 | + wand.readImage(args[1]); | |
40 | + if (null !is args[2].extension) { | |
41 | + wand.setImageFormat(args[2].extension[1..$]); | |
42 | + } | |
39 | 43 | |
40 | - // TODO: Try some methods. | |
44 | + wand.blurImage(6, 3); | |
41 | 45 | |
42 | - // TODO: Implement wand.writeX | |
43 | - stderr.writefln("%s: Writing of images has not been implemented, so " ~ | |
44 | - "this doesn't work correctly yet.", args[0]); | |
45 | - return 0; | |
46 | + wand.writeImage(args[2]); | |
47 | + writefln("Equivalent to:\n gm convert %s -blur 6x3 %s", args[1], args[2]); | |
48 | + | |
49 | + return 0; | |
46 | 50 | } |