Skip to content
This repository has been archived by the owner on Oct 25, 2024. It is now read-only.

Commit

Permalink
ok with this size on cleans... cmd.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitsofcotton authored Apr 10, 2024
1 parent a9dc0b3 commit 4a19a1e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,20 @@
# N.B.
# With ddpmopt/README.md, we have 20kbit upper limit on function entropy.
# We expect 8 bit color for each pixel.
upixr = pow(19683 / 8. / w / h, .5)
upix = pow(19683 / 8., .5)
upixr = upix / pow(w * h, .5)
sz = str(int(upixr * w) + 1) + "x" + str(int(upixr * h) + 1)
# Thanks:
# R.B. https://www.imagemagick.org/Usage/filter/nicolas/#downsample
# From googling, via https://qiita.com/yoya/items/b1590de289b623f18639 .
if(argv[2][- 1] == "q"):
subprocess.call(["convert", line, "-filter", "LanczosRadius", "-distort", "Resize", sz, "-despeckle", "+sigmoidal-contrast", "7.5", "-filter", "LanczosRadius", "-distort", "Resize", str(w) + "x" + str(h) + "!", "-sigmoidal-contrast", "7.5", root + "-cleansq.png"])
elif(argv[2][- 1] == "l"):
subprocess.call(["convert", line, "+sigmoidal-contrast", "7.5", "-filter", "LanczosRadius", "-distort", "Resize", str(int(upixr * upixr * pow(w * h, .5) * w + 1)) + "x" + str(int(upixr * upixr * pow(w * h, .5) * h + 1)), "-sigmoidal-contrast", "7.5", root + "-cleansl.png"])
subprocess.call(["convert", line, "+sigmoidal-contrast", "7.5", "-filter", "LanczosRadius", "-distort", "Resize", str(int(upix * upixr * w + 1)) + "x" + str(int(upix * upixr * h + 1)), "-sigmoidal-contrast", "7.5", root + "-cleansl.png"])
elif(argv[2][- 1] == "m"):
subprocess.call(["convert", line, "-filter", "LanczosRadius", "-distort", "Resize", str(int((upixr + 1) * w)) + "x" + str(int((upixr + 1) * h)) + "!", "+sigmoidal-contrast", "7.5", "-resize", str(int(upixr * upixr * pow(w * h, .5) * w) + 1) + "x" + str(int((upixr + 1) * h)) + "!", "-sigmoidal-contrast", "7.5", root + "-cleansm.png"])
subprocess.call(["convert", line, "+sigmoidal-contrast", "7.5", "-resize", str(int(upix * upixr * w) + 1) + "x" + str(int(upixr * h) + 1) + "!", "-sigmoidal-contrast", "7.5", root + "-cleansm.png"])
elif(argv[2][- 1] == "t"):
subprocess.call(["convert", line, "-resize", str(int(upixr + 1) * w) + "x" + str(h) + "!", "-despeckle", "-equalize", "-despeckle", root + "-cleanst.png"])
subprocess.call(["convert", line, "-resize", str(int(w / upix)) + "x" + str(h) + "!", "-despeckle", "-equalize", "-despeckle", root + "-cleanst.png"])
else:
subprocess.call(["convert", line, "-filter", "LanczosRadius", "-distort", "Resize", sz, "-despeckle", "-equalize", "-despeckle", root + "-cleans.png"])

0 comments on commit 4a19a1e

Please sign in to comment.