def set_predictor(predictor, colors: 1, bitspercomponent: 8, columns: 1)
            filters = self.filters

            layer = filters.index(:FlateDecode) or filters.index(:LZWDecode)
            if layer.nil?
                raise InvalidStreamObjectError, 'Predictor functions can only be used with Flate or LZW filters'
            end

            params = Filter::LZW::DecodeParms.new
            params[:Predictor] = predictor
            params[:Colors] = colors if colors != 1
            params[:BitsPerComponent] = bitspercomponent if bitspercomponent != 8
            params[:Columns] = columns if columns != 1

            set_decode_params(layer, params)

            self
        end
def set_predictor(predictor, colors: 1, bitspercomponent: 8, columns: 1)
            filters = self.filters

            layer = filters.index(:FlateDecode) or filters.index(:LZWDecode)
            if layer.nil?
                raise InvalidStreamObjectError, 'Predictor functions can only be used with Flate or LZW filters'
            end

            params = Filter::LZW::DecodeParms.new
            params[:Predictor] = predictor
            params[:Colors] = colors if colors != 1
            params[:BitsPerComponent] = bitspercomponent if bitspercomponent != 8
            params[:Columns] = columns if columns != 1

            set_decode_params(layer, params)

            self
        end
Set predictor type for the current Stream.
 Applies only for LZW and FlateDecode filters.