joriszwart.nl

Testing

Generating test files

To quickly generate a number of media files I use a little shell script.

It all starts with an SVG that is converted into several different image and video formats. Bonus is a binary and a zip file.

The videos obviously only have 1 frame, but they are valid.

ImageMagick must be installed.

cat > image.svg <<'SVG'
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 240"
    dominant-baseline="middle"
    font-family="monospace"
    font-size="72"
    text-anchor="middle"
>
  <rect width="100%" height="100%" rx="5%" fill="#27a2cc"/>
  <text x="50%" y="50%" fill="#f9f4f2">image</text>
</svg>
SVG

# images and videos in several formats
magick image.svg image.gif
magick image.svg image.jpeg
magick image.svg image.json
magick image.svg image.mpeg
magick image.svg image.mp4
magick image.svg image.png
magick image.svg image.txt
magick image.svg image.webm
magick image.svg image.webp
magick image.svg image.yaml

# create a binary file
cp image.png image.bin


# create some 'corrupt' files
echo "this is not a png" >> corrupt.png
echo "this is not a zip" >> corrupt.zip

# zip file
zip testmedia.zip image* *.sh corrupt*

Related