png support
This commit is contained in:
parent
25cd72190d
commit
24b11a4033
@ -6,8 +6,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
func ffmpegGenerateMP4() {
|
func ffmpegGenerateMP4(fileExt string) {
|
||||||
inputPattern := "./output/img_glitched_%d.jpeg"
|
inputPattern := "./output/img_glitched_%d." + fileExt
|
||||||
outputVideo := "output.mp4"
|
outputVideo := "output.mp4"
|
||||||
|
|
||||||
cmd := exec.Command(
|
cmd := exec.Command(
|
||||||
|
@ -71,9 +71,9 @@ func copyImage(inputFile string, outputFile string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateGlitchedSequence(inputFile string, totalImages int, shitSize int64, iterations int64, chanceToRandom int32) {
|
func generateGlitchedSequence(inputFile string, fileExt string, totalImages int, shitSize int64, iterations int64, chanceToRandom int32) {
|
||||||
for i := 1; i <= totalImages; i++ {
|
for i := 1; i <= totalImages; i++ {
|
||||||
outputFileName := fmt.Sprintf("img_glitched_%d.jpeg", i) // Generate unique filenames
|
outputFileName := fmt.Sprintf("img_glitched_%d.%s", i, fileExt)
|
||||||
|
|
||||||
if rand.Int32N(100) < chanceToRandom {
|
if rand.Int32N(100) < chanceToRandom {
|
||||||
// Glitched image
|
// Glitched image
|
||||||
|
10
main.go
10
main.go
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sourceFile := os.Args[1]
|
sourceFile := os.Args[1]
|
||||||
|
fileExt := filepath.Ext(sourceFile)
|
||||||
|
|
||||||
numCopies, err := strconv.Atoi(os.Args[2])
|
numCopies, err := strconv.Atoi(os.Args[2])
|
||||||
if err != nil || numCopies <= 0 {
|
if err != nil || numCopies <= 0 {
|
||||||
@ -50,12 +52,12 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(os.Stdout, "Generating:\n %d copies of %s\n %d random bytes of data\n %d interations(s)\n Chance to random %d%%\n\n",
|
fmt.Fprintf(os.Stdout, "Generating:\n %d copies of %s\n %d random bytes of data\n %d interations(s)\n Chance to random %d%%\n File Extention: %s\n\n",
|
||||||
numCopies, sourceFile, shitSize, iterations, chanceToRandom)
|
numCopies, sourceFile, shitSize, iterations, chanceToRandom, fileExt)
|
||||||
|
|
||||||
makeOutputDir()
|
makeOutputDir()
|
||||||
defer clearOutputDir()
|
defer clearOutputDir()
|
||||||
|
|
||||||
generateGlitchedSequence(sourceFile, numCopies, shitSize, iterations, int32(chanceToRandom))
|
generateGlitchedSequence(sourceFile, fileExt, numCopies, shitSize, iterations, int32(chanceToRandom))
|
||||||
ffmpegGenerateMP4()
|
ffmpegGenerateMP4(fileExt)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user