png support
This commit is contained in:
parent
25cd72190d
commit
24b11a4033
@ -6,8 +6,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func ffmpegGenerateMP4() {
|
||||
inputPattern := "./output/img_glitched_%d.jpeg"
|
||||
func ffmpegGenerateMP4(fileExt string) {
|
||||
inputPattern := "./output/img_glitched_%d." + fileExt
|
||||
outputVideo := "output.mp4"
|
||||
|
||||
cmd := exec.Command(
|
||||
|
@ -71,9 +71,9 @@ func copyImage(inputFile string, outputFile string) error {
|
||||
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++ {
|
||||
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 {
|
||||
// Glitched image
|
||||
|
10
main.go
10
main.go
@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@ -22,6 +23,7 @@ func main() {
|
||||
}
|
||||
|
||||
sourceFile := os.Args[1]
|
||||
fileExt := filepath.Ext(sourceFile)
|
||||
|
||||
numCopies, err := strconv.Atoi(os.Args[2])
|
||||
if err != nil || numCopies <= 0 {
|
||||
@ -50,12 +52,12 @@ func main() {
|
||||
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",
|
||||
numCopies, sourceFile, shitSize, iterations, chanceToRandom)
|
||||
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, fileExt)
|
||||
|
||||
makeOutputDir()
|
||||
defer clearOutputDir()
|
||||
|
||||
generateGlitchedSequence(sourceFile, numCopies, shitSize, iterations, int32(chanceToRandom))
|
||||
ffmpegGenerateMP4()
|
||||
generateGlitchedSequence(sourceFile, fileExt, numCopies, shitSize, iterations, int32(chanceToRandom))
|
||||
ffmpegGenerateMP4(fileExt)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user