convert(numChannels) {
        if (this.channels === numChannels) return this; // Already correct number of channels

        switch (numChannels) {
            case 1:
                this.grayscale();
                break;
            case 3:
                this.rgb();
                break;
            case 4:
                this.rgba();
                break;
            default:
                throw new Error(`Conversion failed due to unsupported number of channels: ${this.channels}`);
        }
        return this;
    }
Helper method for converting image to have a certain number of channels
@param {number} numChannels The number of channels. Must be 1, 3, or 4.
@returns {RawImage} `this` to support chaining.