Hierarchy

  • Marker

Methods

  • Parameters

    Returns Promise<string>

    image url or base64 string

    Description

    mark image on background image

    Example

    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);
  • Parameters

    Returns Promise<string>

    image url or base64 string

    Description

    mark text on image

    Example

    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);

Generated using TypeDoc