Skip to content

Cum să adaugi fundal textului în ImageMagick

DodaTech Updated 2025-01-15 1 min read

In this tutorial, you'll learn about Cum să adaugi fundal textului în ImageMagick. We cover key concepts, practical examples, and best practices.

In aceasta lectie rapida vei invata sa adaugi un fundal (box) textului pe imagini folosind ImageMagick. Optiunea -box plaseaza un dreptunghi colorat in spatele textului pentru lizibilitate.

The Problem

Textul adaugat pe imagini este greu de citit din cauza fundalului aglomerat. Vrei un fundal colorat in spatele textului.

Solutia

Foloseste optiunea -box impreuna cu -fill:

convert input.jpg -fill white -box "#00000080" -pointsize 36 -annotate +50+50 "Text cu fundal" output.jpg

Output:

input.jpg => output.jpg (text with semi-transparent black background)

Variatii

Fundal negru opac:

convert input.jpg -fill white -box black -pointsize 36 -annotate +50+50 "Text" output.jpg

Fundal semi-transparent:

convert input.jpg -fill white -box "rgba(0,0,0,0.6)" -pointsize 36 -annotate +50+50 "Text" output.jpg

Fundal colorat:

convert input.jpg -fill black -box "#ffcc00" -pointsize 36 -annotate +50+50 "Text" output.jpg

Greșeli comune

  1. Fundal care nu contrasteaza -- Asigura contrast intre -fill si -box.
  2. Box opac care acopera -- Foloseste transparenta pentru a vedea subtil fundalul.
  3. Ignorarea pozitiei -- Box-ul urmareste textul, nu invers.
  4. Format gresit pentru transparenta -- Salveaza ca PNG pentru transparenta.
  5. Box prea mare sau prea mic -- Dimensiunea se ajusteaza automat dupa text.

Intrebari frecvente

### Pot controla marimea box-ului?

Nu direct cu -box. Pentru control avansat, deseneaza un dreptunghi manual cu -draw.

### Box-ul functioneaza cu -annotate?

Da, este conceput special pentru -annotate si -draw text.

*Construit de dezvoltatorii Doda Browser, DodaZIP si Durga Antivirus Pro. Instrumentele DodaTech se integreaza perfect cu ImageMagick pentru productivitate si securitate sporite.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro