Skip to content

Commit

Permalink
QuitarFondoStep2FromMeth.py
Browse files Browse the repository at this point in the history
  • Loading branch information
V1lch1s authored Nov 7, 2023
1 parent 3eca19c commit 15f0500
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions QuitarFondoStep2FromMeth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
print("----Eliminador de Fondo (Transparentador de pngs)----")
print("\nRequisitos de entrada:\n")
print("1-La imagen de entrada debe ser PNG\n")
print("2-El fondo debe ser RGB(34, 177, 76)\n\n-Recomendación: Editar imagen en Microsoft Paint ya que el color requerido\n\t\tes el verde oscuro que aparece por defecto en la aplicación.\n\n")
print("2-El fondo debe ser RGB(0, 255, 0)\n\n")
carpeta = str(input('Carpeta (Nombre): '))
imgName = str(input("Imagen que desea alterar (Imagen.png): "))
img = Image.open(carpeta+'/'+imgName)
Expand All @@ -16,7 +16,7 @@
pixdata = img.load()
for y in range(img.size[1]):
for x in range(img.size[0]):
if pixdata[x,y][0] in range(15, 137) and pixdata[x,y][1] in range(124, 200) and pixdata[x,y][2] in range(40, 131):
if pixdata[x,y][0] == 0 and pixdata[x,y][1] == 255 and pixdata[x,y][2] == 0:
pixdata[x, y] = (255, 255, 255,0)

img.save("{}/{}".format(carpeta,imgName)) #Image.save(fp, format=None, **params)
Expand Down

0 comments on commit 15f0500

Please sign in to comment.