Skip to content

Pre and post processing parameters

andreweathan edited this page Aug 26, 2022 · 8 revisions

These properties control effects applied before the actual corruption effects.
These usually make the image prettier!
-crunch, -blackbg, and -div are especially useful.

-contrast (-1 to 1, def 0)

Image contrast applied before corruption. 0 is neutral, -1 is the lowest contrast, 1 is the highest.

Original No contrast -contrast 0.5 -contrast -0.5
eathan output output output

#2: node pngfucker.js -input eathan.png -frames 20 -fps 10 -crunch 60 -seed 50 -splits 1 -regions 0 -shift 0 -div 1 -blackbg 1 -rmin -10 -rmax -8
#3: node pngfucker.js -input eathan.png -frames 20 -fps 10 -crunch 60 -seed 50 -splits 1 -regions 0 -shift 0 -div 1 -blackbg 1 -rmin -10 -rmax -8 -contrast 0.5
#4: node pngfucker.js -input eathan.png -frames 20 -fps 10 -crunch 60 -seed 50 -splits 1 -regions 0 -shift 0 -div 1 -blackbg 1 -rmin -10 -rmax -8 -contrast -0.5

-mul (def. 1)

Multiplies output image size by this value.

-div (def. 1)

Divides output image size by this value.
This is often useful, because corruption on large, detail-filled images often looks bad.
-div and -crunch is a good combination to make corruption look better!

Note that both -mul and -div are applied! You can use whichever you wish.

-seed (def. random number between 0 and 65536)

Lets you reuse corruption randomisation!
If no seed is specified, a random one is picked.

-staticseed (def. 0, 0 - no, 1 - yes)

Using -staticseed 0 means that the internal seed for each frame of an APNG will be different, creating a jittery corruption effect to it.
Using -staticseed 1 keeps it constant across all frames, so that your eyes don't go pop from the corruption!
This doesn't affect the ability to recreate the APNG corruption, so using the same -seed value will yield the same corruption with APNGs!

Epilepsy warning, flashy example
Original Without -staticseed -staticseed 1
cube output output

#2: node pngfucker.js -input cube.png -seed 0 -blackbg 1
#3: node pngfucker.js -input cube.png -seed 0 -blackbg 1 -staticseed 1

-crunch (def. 100, 1-100)

Resizes image to this percentage in pre-processing, and resizes them back to normal in post-processing, to "crunch" the pixels.
This gives a nice, pixel-like effect to the glitching, and it mostly works well with small low-detail images (256x256, 512x512, you get the idea)
This parameter is a good alternative to -div, because you won't have to resize it back to normal size afterwards.
NOTE: Don't add a percent sign! Resizing and crunching uses nearest-neighbor interpolation, so you can enjoy crispy glitching.

Original -crunch 100 -crunch 50 -crunch 15
eathan output output output

#2: node pngfucker.js -input eathan.png -seed 2 -splits 1 -splitmin 50 -clamp 0 -blackbg 1 -regions 3 -crunch 100
#3: node pngfucker.js -input eathan.png -seed 2 -splits 1 -splitmin 50 -clamp 0 -blackbg 1 -regions 3 -crunch 50
#4: node pngfucker.js -input eathan.png -seed 2 -splits 1 -splitmin 50 -clamp 0 -blackbg 1 -regions 3 -rmin 2 -rmax 5 -crunch 15

-blackbg (def. 0, 0 - no, 1 - yes)

Normally, due to the way pngfucker corrupts images, alpha bits get mangled with RGB bits, causing changes in transparency for some pixels.
Usually, it looks way too "bright" on a white background, so -blackbg 1 underlays a black background behind the image, increasing the contrast of the image in the process and giving the corruption a nice rough effect.

Original Without -blackbg -blackbg 1
eathan output output

NOTE: If you're viewing this with a dark theme (or anything that makes the page dark), you might not see the difference easily.

#2: node pngfucker.js -input eathan.png -seed 2 -splits 1 -splitmin 50 -crunch 50
#3: node pngfucker.js -input eathan.png -seed 2 -splits 1 -splitmin 50 -crunch 50 -blackbg 1

-clamp (def. 1, 0 - no, 1 - yes)

This "localises" the corruption on a transparent image/APNG, ignoring corruption outside the "main area" of the image (unless its pixel delta is >64)
Without it, corruption affects the whole image. See the examples below for more information!

Epilepsy warning, flashy example
Original Without -clamp -clamp 1
cube output output

#2: node pngfucker.js -input cube.png -seed 0
#3: node pngfucker.js -input cube.png -seed 0 -clamp 1