Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
V1lch1s authored Oct 13, 2023
0 parents commit bee7244
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions QuitarFondoStep2FromMeth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from PIL import Image
#from PyQt5.QtWidgets import QInputDialog
import numpy as np
import cv2

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")
carpeta = str(input('Carpeta (Nombre): '))
imgName = str(input("Imagen que desea alterar (Imagen.png): "))
img = Image.open(carpeta+'/'+imgName)

#Color a retirar: RGB: ( 34, 177, 76)
img = img.convert('RGBA')
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):
pixdata[x, y] = (255, 255, 255,0)

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

0 comments on commit bee7244

Please sign in to comment.