Skip to content

Documentation: The commandline script

Chase edited this page Jul 26, 2020 · 8 revisions

Welcome to the glitch-this commandline script docs! Here you will find all the information you need to get glitching, directly from your commandline!

If you don't have the library already, get it on pypi

You can invoke the script using glitch_this [image_path] [glitch_level] from anywhere, anytime! Once you have the library installed.

TL;DR - Basic Usage

Simply pass in the image path and glitch level!

basic

TL; DR - GIF creation

Same as last time, just include the -g option

gif

Here's some points about the parameters - and what they do!

  • -h : Shows help text, use this to get used to the parameters!

    Ex - glitch_this -h`

    (OR) glitch_this -h

Required Parameters

  • IMAGE_PATH : The script needs to know, what file you want to glitchify right?

    That's exactly what this is for, you supply the full/relative path to the image you want to glitchify.

    Remember, the path must exist as an image file. PNG, JPEG, GIF are certainly preferred.

    This is also where the output will be stored.

    Ex - glitch_this test.png

    (OR) glitch_this test.png

  • GLITCH_LEVEL : A number between 0.1 to 10.0 (including both endpoints), signifying how glitched the output image should be.

    0.1 stands for "you call this glitched?", 10.0 stands for "good luck understanding this one"

    You're absolutely free to use floats, but remember, internally they will be converted to int when needed. So floats with maximum of 1-2 decimal places will make a difference in the output. There likely will not be any difference between 1.591 and 1.610, but there will be between 1.5 and 1.6

    my personal favorite is 2 if anyone cares :P

    Ex - glitch_this 2

    (OR) glitch_this 2

So, with all the required parameters in place, this is how the command should look like - glitch_this test.png 2

Optional Parameters - File Path Management

  • -o : Specify full/relative path to write the output file into

    Defaults to current_dir/glitched_(src_img_filename)

    Ex - glitch_this -o /home/not_glitched.png test.png 2

    The above command, will take test.png as input from current working directory, glitch it and save it in /home with the name not_glitched.png

  • -f : Force overwriting existing file. If the output file happens to have the same name as another file in that path, the program will abort without overwriting, unless -f is included

    Defaults to False

    Ex - glitch_this -f test.png 2

Optional Parameters - Image Manipulation

  • -c : If included, the glitched image will have a color offset, more realistic glitching!

    Ex - glitch_this -c test.png 2

  • -s : If included, the glitched image will have scan lines

    Ex - glitch_this -s test.png 2

  • -g : If included, the output will be GIF

    Ex - glitch_this -g test.png 2

  • -sd Seed : Use a custom seed for the RNG used

    This ensures you generate predictable glitches

    Defaults to None

    Ex- glitch_this -sd 42 test.png 2

  • -fr Frames : Specify the number of glitched images to be used in GIF

    Defaults to 23

    Ex - glitch_this -g -fr 10 test.png 2

  • -st Step : Glitch every step'th frame instead of all frames

    Defaults to 1, i.e glitch every frame

    If included this will glitch every step'th frame, keeping the other frames untouched. There will still be exactly the number of frames specified, either by -fr Frames or the default 23

    Ex - glitch_this -g -st 2 test.png 2

  • -i Increment : Increment/Decrement the glitch_amount by given value after every frame glitched

    Defaults to 0.0, i.e glitch_amount will stay the same after every frame glitched

    You can use a negative value to decrement it instead!

    The input should be a number (integer or floating point) between 0.0 and 10.0 (inclusive) or -0.0 and -10.0 (inclusive)

    Ex - glitch_this -i 1 test.png 2

    The above command will start glitch_amount at 2 and increment it by 1 every frame glitched

    Ex - glitch_this -i -1 test.png 9

    The above command will start glitch_amount at 9 and decrement it by 1 every frame glitched

  • -cy : Use this if glitch_amount should be looped back to 0.1 or 10.0, if it overflows or underflows

    Defaults to False, i.e glitch_amount will stay at 0.1 or 10.0, instead of getting looped back

    glitch_amount will get incremented/decremented if -i Increment is included, when it gets decremented to or beyond 0.0, it'll be underflowed to or beyond 10.0 if -cy is included. Likewise, when it gets incremented to or beyond10.0, it'll be overflowed to or beyond 0.1

    Ex - glitch_this -i -1 -cy test.png 9

  • -d Duration : Specify the time (in centiseconds - hundredths of a second), a single frame is visible

    Defaults to 200

    Ex - glitch_this -g -d 500 test.png 2

    tip : if you want the GIF to be slower, supply a bigger duration value

  • -rd Relative_Duration : Use a duration relative to the original GIF's duration

    This is only used for glitching input GIFs using -ig

    This overrides -d Duration

    Ex- glitch_this -ig -rd 2 test.gif 2

    The resulting glitched GIF from the above command will have a duration (per frame) double the duration of original GIF's duration (per frame)

  • -l Loop_Count : Specify how many times the output GIF should loop

    Defaults to 0, i.e infinite loop

    Ex - glitch_this -g -l 10 test.png 2

  • -ig : Use this when input image is a GIF. Takes an input GIF and outputs a glitched output GIF

    Defaults to False

    Presence -g and -f FRAMES parameters will make no difference if -ig is specified

    Remember, this is a time consuming process!

    Ex (with duration) - glitch_this -ig -d 500 test.gif 2

That's it! Have fun glitching!