@Override
    public AsciiImage execute(AsciiImage img) throws OperationException {

        charset = img.getCharset();

        if (!charset.contains("" + threshold))
            throw new OperationException();

        for (int x = 0; x < img.getWidth(); ++x) {
            for (int y = 0; y < img.getHeight(); ++y) {
                if (valueOf(img.getPixel(x, y)) < valueOf(threshold))
                    img.setPixel(x, y, darkest());
                else
                    img.setPixel(x, y, brightest());
            }
        }

        return img;
    }