Version final

This commit is contained in:
luisgulo 2025-02-09 16:26:03 +01:00
commit c01c2ae5f3
31 changed files with 153 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
DNI_v3-anverso.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

BIN
DNI_v3-reverso.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

BIN
DNI_v4-anverso.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
DNI_v4-reverso.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 412 KiB

51
README.md Normal file
View File

@ -0,0 +1,51 @@
# Proteger DNI para envío
Script Bash para enviar/compartir el DNI por medios electrónicos de forma segura.
* Crea bloque ocultando zonas de información.
* Escribe texto sobre la imagen.
* Genera resultado en "tonos grises".
* Utiliza `convert` (parte del programa ImageMagick para transformar imagenes).
* Usa `zenity` para pedir datos.
![](cabecera-dni.png)
## Paquetes necesarios
Instalar `convert` y `zenity`
```
sudo apt update
sudo apt -y upgrade
sudo apt -y install imagemagick zenity
```
## Uso protección completa
Simplemente desde la consola "invoca" al script:
```
./protege-dni.sh
```
## Uso con 'Marca de agua'
Simplemente desde la consola ejecuta el script:
```
./protege-dni-MarcaAgua.sh
```
En ambos casos saldrá asistente para seleccionar cada cara del DNI a proteger
![](imagenes/seleccione-anverso.png)
![](imagenes/seleccione-reverso.png)
El resultado dependiendo del script usado será:
![](DNI_v3-anverso-protegido.jpg)
![](DNI_v3-anverso-MarcaAgua.jpg)

BIN
cabecera-dni.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 KiB

BIN
dni-3-0-vs-dni-4-0.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

52
protege-dni-MarcaAgua.sh Executable file
View File

@ -0,0 +1,52 @@
#!/bin/bash
# Tamano oficial DNI (3.0 y 4.0) es 85,60x53,98 mm
# Solicitar ficheros origen del DNI (Anverso y Reverso)
zenity --info --text="Seleccione la imagen con el ANVERSO"
ANVERSO=$(zenity --file-selection)
zenity --info --text="Seleccione la imagen con el REVERSO"
REVERSO=$(zenity --file-selection)
# Ficheros temporales (escalado)
AnvTMP="${ANVERSO%.*}-tmp.jpg"
RevTMP="${REVERSO%.*}-tmp.jpg"
# Ficheros Salida
AnvIMG="${ANVERSO%.*}-MarcaAgua.jpg"
RevIMG="${REVERSO%.*}-MarcaAgua.jpg"
# Anverso Zona de Bloques de ocultacion
CAN='800,370,1000,605'
SOPORTE='400,440,570,485'
# Reverso Zona de Bloques de ocultacion
EQUIPO='5,177,100,355'
PADRES='280,317,620,376'
IDE='50,430,980,520'
# Pedimos texto al usuario
TEXTO=$(zenity --entry --text="Escriba el mensaje a poner en la imagen" --entry-text="** SOLO PARA VERIFICACION EMPRESA **")
# Temporales Escalados
echo "Preparando Imagenes temporales (escaladas).."
convert "$ANVERSO" -resize 1011x638 -units PixelsPerInch -density 150 "$AnvTMP" 2>/dev/null
convert "$REVERSO" -resize 1011x638 -units PixelsPerInch -density 150 "$RevTMP" 2>/dev/null
echo "Ocultando, fijando texto y escala gris en ANVERSO"
#convert "$AnvTMP" -font courier -fill blue -pointsize 40 -gravity center -annotate 0 "$TEXTO" -units PixelsPerInch -density 150 "$AnvIMG"
convert "$AnvTMP" -font courier -fill blue -pointsize 40 -density 80 -gravity center -annotate 0 "$TEXTO" -units PixelsPerInch -density 150 "$AnvIMG"
echo "Ocultando, fijando texto y escala gris en REVERSO"
#convert "$RevTMP" -font courier -fill blue -pointsize 40 -gravity center -annotate 0 "$TEXTO" -units PixelsPerInch -density 150 "$RevIMG"
convert "$RevTMP" -font courier -fill blue -pointsize 40 -density 80 -gravity center -annotate 0 "$TEXTO" -units PixelsPerInch -density 150 "$RevIMG"
echo "Limpiando temporales..."
rm "$AnvTMP" "$RevTMP"
echo
echo "-----------------------------------------------"
echo "Imagenes de DNI Listas y protegidas para envio"
echo " Anverso: $AnvIMG"
echo " Reverso: $RevIMG"
echo "-----------------------------------------------"
echo

50
protege-dni.sh Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# Tamano oficial DNI (3.0 y 4.0) es 85,60x53,98 mm
# Solicitar ficheros origen del DNI (Anverso y Reverso)
zenity --info --text="Seleccione la imagen con el ANVERSO"
ANVERSO=$(zenity --file-selection)
zenity --info --text="Seleccione la imagen con el REVERSO"
REVERSO=$(zenity --file-selection)
# Ficheros temporales (escalado)
AnvTMP="${ANVERSO%.*}-tmp.jpg"
RevTMP="${REVERSO%.*}-tmp.jpg"
# Ficheros Salida
AnvIMG="${ANVERSO%.*}-protegido.jpg"
RevIMG="${REVERSO%.*}-protegido.jpg"
# Anverso Zona de Bloques de ocultacion
CAN='800,370,1000,605'
SOPORTE='400,440,570,485'
# Reverso Zona de Bloques de ocultacion
EQUIPO='5,177,100,355'
PADRES='280,317,620,376'
IDE='50,430,980,520'
# Pedimos texto al usuario
TEXTO=$(zenity --entry --text="Escriba el mensaje a poner en la imagen" --entry-text=">> SOLO USO INTERNO Empresa <<")
# Temporales Escalados
echo "Preparando Imagenes temporales (escaladas).."
convert "$ANVERSO" -resize 1011x638 -units PixelsPerInch -density 150 "$AnvTMP" 2>/dev/null
convert "$REVERSO" -resize 1011x638 -units PixelsPerInch -density 150 "$RevTMP" 2>/dev/null
echo "Ocultando, fijando texto y escala gris en ANVERSO"
convert "$AnvTMP" -fill gray -draw "rectangle $CAN" -fill gray -draw "rectangle $SOPORTE" -font helvetica -fill black -pointsize 30 -density 90 -gravity center -annotate 0 "$TEXTO" -grayscale average -units PixelsPerInch -density 150 "$AnvIMG"
echo "Ocultando, fijando texto y escala gris en REVERSO"
convert "$RevTMP" -fill gray -draw "rectangle $EQUIPO" -fill gray -draw "rectangle $PADRES" -fill gray -draw "rectangle $IDE" -font helvetica -fill black -pointsize 30 -density 90 -gravity center -annotate 0 "$TEXTO" -grayscale average -units PixelsPerInch -density 150 "$RevIMG"
echo "Limpiando temporales..."
rm "$AnvTMP" "$RevTMP"
echo
echo "-----------------------------------------------"
echo "Imagenes de DNI Listas y protegidas para envio"
echo " Anverso: $AnvIMG"
echo " Reverso: $RevIMG"
echo "-----------------------------------------------"
echo