image marker for rn
    Preparing search index...

    Class Marker

    Index

    Methods

    • Mark ordered text and image watermark layers with one call.

      Use this for mixed text and image layers. Layers are rendered natively in array order, so later layers draw over earlier layers.

      Parameters

      Returns Promise<string>

      image url or base64 string

      const result = await ImageMarker.mark({
      backgroundImage: { src: require('./images/background.jpg') },
      watermarks: [
      {
      type: 'text',
      text: 'Demo',
      position: { position: Position.bottomCenter, Y: 24 },
      style: { color: '#ffffff', fontSize: 32 },
      },
      {
      type: 'image',
      src: require('./images/logo.png'),
      position: { position: Position.topRight, X: 24, Y: 24 },
      scale: 0.5,
      },
      ],
      saveFormat: ImageFormat.png,
      });
    • Mark image-only watermarks on a background image.

      This remains the supported API for image-only use cases. Use mark when text and image watermarks need to be composed together in one ordered native render pass.

      Parameters

      Returns Promise<string>

      image url or base64 string

      const options = {
      backgroundImage: {
      src: require('./images/test.jpg'),
      scale: 1,
      rotate: 20,
      alpha: 0.5,
      },
      quality: 100,
      filename: 'test',
      saveFormat: ImageFormat.png,
      watermarkImages: [
      {
      src: require('./images/logo.png'),
      scale: 0.5,
      rotate: 45,
      alpha: 0.5,
      position: {
      X: 10,
      Y: 10,
      },
      },
      {
      src: require('./images/logo1.png'),
      scale: 0.5,
      rotate: 45,
      alpha: 0.5,
      position: {
      position: Position.center,
      },
      },
      ],
      };
      ImageMarker.markImage(options).then((res) => {
      console.log(res);
      }).catch((err) => {
      console.log(err);
      });
      // or
      await ImageMarker.markImage(options);
    • Mark text-only watermarks on an image.

      This remains the supported API for text-only use cases. Use mark when text and image watermarks need to be composed together in one ordered native render pass.

      Parameters

      Returns Promise<string>

      image url or base64 string

      const options = {
      backgroundImage: {
      src: require('./images/test.jpg'),
      scale: 1,
      rotate: 20,
      alpha: 0.5,
      },
      watermarkTexts: [
      {
      text: 'hello',
      positionOptions: {
      position: Position.center,
      },
      style: {
      color: '#ff00ff',
      fontSize: 30,
      fontName: 'Arial',
      rotate: 30,
      shadowStyle: {
      dx: 10,
      dy: 10,
      radius: 10,
      color: '#ffaa22',
      },
      textBackgroundStyle: {
      paddingX: 10,
      paddingY: 10,
      type: TextBackgroundType.none,
      color: '#faaaff',
      },
      underline: true,
      strikeThrough: true,
      textAlign: 'left',
      italic: true,
      bold: true,
      },
      },
      {
      text: 'world',
      positionOptions: {
      X: 10,
      Y: 10,
      },
      style: {
      color: '#AAFFDD',
      fontSize: 30,
      fontName: 'Arial',
      rotate: 170,
      shadowStyle: {
      dx: 10,
      dy: 10,
      radius: 10,
      color: '#ffaa22',
      },
      textBackgroundStyle: {
      paddingX: 10,
      paddingY: 10,
      type: TextBackgroundType.stretchX,
      color: '#faaaff',
      },
      textAlign: 'right',
      skewX: 10,
      ],
      scale: 1,
      quality: 100,
      filename: 'test',
      saveFormat: ImageFormat.png,
      };
      ImageMarker.markText(options).then((res) => {
      console.log(res);
      }).catch((err) => {
      console.log(err);
      });
      // or
      await ImageMarker.markText(options);