• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

213
Views
Node Jimp - Cómo agregar un texto con un fondo cuadrado

Necesito agregar un texto en una imagen usando el módulo de nodo Jimp. Pero a veces se confunde con la imagen. Por ejemplo: el texto negro pasa el cursor sobre una imagen con negro sobre sí mismo.

Así que necesito insertar un cuadrado blanco y escribir con negro dentro.

No lo encontré en la documentación de Jimp.

Mi código real:

 await Jimp2.read(nomeArquivo) .then(function (image) { loadedImage = image; return Jimp2.loadFont(Jimp2.FONT_SANS_16_BLACK); }) .then(function (font) { loadedImage.print(font, 45, 45,'car' ,450 , (err, image, { x, y }) => { image.print(font, 45, y + 4, { text: 'this car is ok', alignmentX: Jimp2.HORIZONTAL_ALIGN_CENTER, alignmentY: Jimp2.VERTICAL_ALIGN_MIDDLE },450); } ) .write(nomeArquivo); }) .catch(function (err) { console.error(err); });

Esto escribe el texto sobre la imagen, pero no el cuadrado.

¡Gracias!

almost 3 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error