browser-image
    Preparing search index...

    An immutable chain of corrections. Each method returns a new pipeline with one more step; run() applies all steps in one pass in linear light, so no precision is lost to 8-bit rounding between steps.

    const p = pipeline().exposure(0.5).contrast(0.2).saturation(0.1);
    const out = await p.run(img, { output: 'canvas' });
    Index
    ops: readonly OpSpec[]

    The normalized steps, in order.

    • get margin(): number

      Pixels of context the pipeline needs around each part of a picture: when a tile is run with this many pixels of its neighbours on every side (and the margin is cropped off afterwards), it matches the same area of the whole picture run at once, so tile seams cannot show. 0 unless the pipeline has sharpen steps.

      Returns number

    • Returns a pipeline with step op set to params: the first step of that kind is updated in place (parameters not given keep their values), or the step is appended when the pipeline has none. Made for controls: each slider sets its own step without rebuilding the chain.

      Steps with one main value (brightness, contrast, exposure, gamma, saturation, temperature, sharpen, ...) also take that value as a number; OpInfo.value names it.

      Type Parameters

      • N extends
            | "saturation"
            | "brightness"
            | "contrast"
            | "exposure"
            | "gamma"
            | "temperature"
            | "tint"
            | "whiteBalance"
            | "shadows"
            | "highlights"
            | "curve"
            | "levels"
            | "stretch"
            | "autoStretch"
            | "sharpen"

      Parameters

      Returns Pipeline

      let p = pipeline().exposure(0).contrast(0).sharpen({ amount: 0 });
      p = p.set('contrast', 0.3); // same as { amount: 0.3 }
      p = p.set('sharpen', { radius: 2 }); // amount stays 0
      p = p.set('levels', { inBlack: 0.05 }); // appended: there was no levels step
    • The first step of kind op, with its normalized parameters, or undefined when there is none.

      Type Parameters

      • N extends
            | "saturation"
            | "brightness"
            | "contrast"
            | "exposure"
            | "gamma"
            | "temperature"
            | "tint"
            | "whiteBalance"
            | "shadows"
            | "highlights"
            | "curve"
            | "levels"
            | "stretch"
            | "autoStretch"
            | "sharpen"

      Parameters

      • op: N

      Returns
          | Extract<{ op: "brightness"; amount: number }, { op: N }>
          | Extract<{ op: "contrast"; amount: number }, { op: N }>
          | Extract<{ op: "exposure"; ev: number }, { op: N }>
          | Extract<{ op: "gamma"; gamma: number }, { op: N }>
          | Extract<{ op: "saturation"; amount: number }, { op: N }>
          | Extract<{ op: "temperature"; amount: number }, { op: N }>
          | Extract<{ op: "tint"; amount: number }, { op: N }>
          | Extract<
              { op: "whiteBalance" } & Required<WhiteBalanceOptions>,
              { op: N },
          >
          | Extract<{ op: "shadows"; amount: number }, { op: N }>
          | Extract<{ op: "highlights"; amount: number }, { op: N }>
          | Extract<
              {
                  op: "curve";
                  points: CurvePoint[];
                  red: CurvePoint[];
                  green: CurvePoint[];
                  blue: CurvePoint[];
              },
              { op: N },
          >
          | Extract<{ op: "levels" } & Required<LevelsOptions>, { op: N }>
          | Extract<{ op: "stretch"; black: RGBValues; white: RGBValues }, { op: N }>
          | Extract<{ op: "autoStretch" } & Required<AutoStretchOptions>, { op: N }>
          | Extract<{ op: "sharpen" } & Required<SharpenOptions>, { op: N }>
          | undefined

    • Returns a pipeline without any step of kind op.

      Parameters

      • op:
            | "saturation"
            | "brightness"
            | "contrast"
            | "exposure"
            | "gamma"
            | "temperature"
            | "tint"
            | "whiteBalance"
            | "shadows"
            | "highlights"
            | "curve"
            | "levels"
            | "stretch"
            | "autoStretch"
            | "sharpen"

      Returns Pipeline

    • The same correction for the image shrunk by factor (0.5 = half the width and height): pixel distances (the sharpen radius) are scaled with it, so a preview on a smaller copy looks like the full-size result.

      Parameters

      • factor: number

      Returns Pipeline

    • Returns a pipeline with every autoStretch replaced by a fixed stretch computed from stats, the histogram of the image (or of the area of a tiled image) it will run on. Every image run through the result gets the same range. With null, autoStretch steps are removed.

      Parameters

      Returns Pipeline