I've created my own bunch of scripts to: convert comic in PDF -> images, shave margins, scale images and compose a PDF that fits perfectly on my ebook screen.
But I've noticed that (due to the scanning process) the black colours in images are "grays" and the white background has "junk". You can see it in this example:

By using The GIMP, I'm able to change the colour curve (Right Click -> Colours -> Curves) to "enhance" the black and "homogenize" the whites:

This is a manual process and I would like to add the "improve black + homogenize white" effect to my "convert" command line scripts.
Is it possible to achieve such effect from "command line"?
Thanks.