Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
Cree una imagen con mis iniciales usando TypeScript y no paquetes de terceros

Estoy usando Node.js 14.18.1 y necesito crear una imagen, jpeg, con mis iniciales usando TypeScript, sin el uso de paquetes de terceros, como lienzo.

Realicé esta tarea usando lienzo, pero no se implementa bien en varios sistemas operativos en mi entorno.

Cualquier fragmento sería apreciado.

Como referencia, aquí está la función que creé usando el paquete canvas del registro npm:

 const generateAvatar = ({ text, foregroundColor = 'white', backgroundColor = '#041c2c', height = 42, width = 42 }: { text: string, foregroundColor?: string, backgroundColor?: string, height?: number, width?: number }): Buffer => { const canvas = createCanvas(width, height); const context = canvas.getContext('2d'); // Draw background context.fillStyle = backgroundColor; context.fillRect(0, 0, canvas.width, canvas.height); // Draw text context.font = "1em Arial"; context.fillStyle = foregroundColor; context.textAlign = "center"; context.textBaseline = "middle"; context.fillText(text, canvas.width / 2, canvas.height / 2); const buffer = canvas.toBuffer("image/jpeg"); return buffer; }
about 4 years ago · Santiago Gelvez
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!