Method: Magick::Image#sepiatone

Defined in:
ext/RMagick/rmimage.cpp

#sepiatone(threshold = Magick::QuantumRange) ⇒ Magick::Image

Applies a special effect to the image, similar to the effect achieved in a photo darkroom by sepia toning.

Returns a new image.

Parameters:

  • threshold (Numeric) (defaults to: Magick::QuantumRange)

    Threshold ranges from 0 to QuantumRange and is a measure of the extent of the sepia toning. A threshold of 80% is a good starting point for a reasonable tone.

Returns:



12737
12738
12739
12740
12741
12742
12743
12744
12745
12746
12747
12748
12749
12750
12751
12752
12753
12754
12755
12756
12757
12758
12759
12760
12761
12762
12763
12764
# File 'ext/RMagick/rmimage.cpp', line 12737

VALUE
Image_sepiatone(int argc, VALUE *argv, VALUE self)
{
    Image *image, *new_image;
    double threshold = (double) QuantumRange;
    ExceptionInfo *exception;

    image = rm_check_destroyed(self);

    switch (argc)
    {
        case 1:
            threshold = NUM2DBL(argv[0]);
            break;
        case 0:
            break;
        default:
            rb_raise(rb_eArgError, "wrong number of arguments (%d for 0 or 1)", argc);
    }

    exception = AcquireExceptionInfo();
    GVL_STRUCT_TYPE(SepiaToneImage) args = { image, threshold, exception };
    new_image = (Image *)CALL_FUNC_WITHOUT_GVL(GVL_FUNC(SepiaToneImage), &args);
    rm_check_exception(exception, new_image, DestroyOnError);
    DestroyExceptionInfo(exception);

    return rm_image_new(new_image);
}