Comments (1)
a working python script that saves images to .\processed_items_D2R\
import glob
import subprocess
import time
import os
# post processing for transparency. then do resizing
# fuzz 11% removed too much if the dark pixels in the weps/armors. originally had 7% but chose 5.5% to remove the least pixels from the objects
# fuzz of 5.5% didnt work well on the helm invfhl. set fuzz to 4.5%
hd_pngs = glob.glob('png-hd/*hd.png')
for hd_png in hd_pngs:
print(f'starting to process: {os.path.basename(hd_png)}')
cmd = 'convert ' + hd_png + ' -bordercolor black -border 1x1 -fuzz 4.5% -transparent black -shave 1x1 .\\processed_items_D2R\\tmp.png'
subprocess.run(cmd, shell=True, check=True)
cmd = 'convert .\\processed_items_D2R\\tmp.png -alpha extract .\\processed_items_D2R\\tmp2.png'
subprocess.run(cmd, shell=True, check=True)
cmd = 'convert .\\processed_items_D2R\\tmp2.png -define connected-components:mean-color=true -define connected-components:area-threshold=200 -connected-components 4 .\\processed_items_D2R\\tmp3.png'
subprocess.run(cmd, shell=True, check=True)
cmd = 'convert .\\processed_items_D2R\\tmp3.png -blur 0x0.5 .\\processed_items_D2R\\tmp3-b.png'
subprocess.run(cmd, shell=True, check=True)
cmd = 'convert ' + hd_png + ' .\\processed_items_D2R\\tmp3-b.png -alpha off -compose copy_opacity -composite .\\processed_items_D2R\\' + os.path.basename(hd_png)[:-4] + '-trspr.png'
subprocess.run(cmd, shell=True, check=True)
time.sleep(0.25)
# size of D2R invgisu 98 x 392. size of D2 hd.png 112 x 448 scale 87.5% both x and y -v'
# tried with and without sharpening. No-sharpening looked better in-game
trsp_pngs = glob.glob('processed_items_D2R/*trspr.png')
for trsp_png in trsp_pngs:
print(f'starting to process: {os.path.basename(trsp_png)}')
cmd = 'convert ' + trsp_png + ' -resize 87.5% ' + trsp_png[:-4] + '-resize.png'
subprocess.run(cmd, shell=True, check=True)
time.sleep(0.25)
from dc6_png_enhance.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dc6_png_enhance.