Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

model-to-image

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

model-to-image

model-to-image is a image generater for both browser and node.

  • 0.0.2
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

model-to-image

model-to-image is a image generater for both browser and node.

Installation

$ yarn add model-to-image

or

$ npm install model-to-image

Quick Start

import { modelToImage, Layout } from 'model-to-image';

const model:Layout = {
  width: 500,
  height: 800,
  elements: [
    {
      type: 'rect',
      left: 0,
      top: 0,
      width: 500,
      height: 800,
      style: 'rgb(62, 36, 19)'
    },
     {
      type: 'image',
      width: 300,
      left: 0,
      top: 0,
      url: 'https://st0.dancf.com/gaoding-material/0/images/354641/20200108-213854-NjUJI.jpg'
    },
     {
      type: 'image',
      width: 200,
      left: 300,
      top: 0,
      url: 'https://gd-filems.dancf.com/mcm79j/mcm79j/023e91cb-1235-4a45-b782-eba93e4250aa14867.jpg'
    },
    {
      type: 'image',
      left: 300,
      top: 140,
      width: 200,
      url: 'https://gd-filems.dancf.com/mcm79j/mcm79j/8119022d-79eb-421e-9c8e-0e5e1418dee314866.png'
    },
    {
      type: 'image',
      left: 300,
      top: 300,
      width: 200,
      url: 'https://st0.dancf.com/gaoding-material/0/images/353985/20200108-213027-qjucQ.jpg'
    },
     {
      type: 'text',
      text: `登高\n杜甫\n风急天高猿啸哀,渚清沙白鸟飞回。\n无边落木萧萧下,不尽长江滚滚来。\n万里悲秋常作客,百年多病独登台。\n艰难苦恨繁霜鬓,潦倒新停浊酒杯。\n`,
      left: 250,
      top: 550,
      width: 500,
      textAlign: 'center',
      style: 'white',
      font: '20px Arial',
      lineHeight: 30,
    }
  ]
}

modelToImage(model).then((url) => {
  console.log(url);
})

Generate Image:

Documentation

FAQs

Package last updated on 21 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc