Add test data

This commit is contained in:
iacore
2024-07-12 20:13:02 +00:00
parent 77028fc33d
commit a9a5f9a8b0
6 changed files with 67 additions and 0 deletions
+1
View File
@@ -6,6 +6,7 @@ require (
github.com/goccy/go-json v0.10.2
github.com/gofiber/fiber/v2 v2.52.4
github.com/gofiber/template/jet/v2 v2.1.9
github.com/kettek/apng v0.0.0-20220823221153-ff692776a607
github.com/tidwall/gjson v1.17.1
golang.org/x/net v0.24.0
)
+2
View File
@@ -18,6 +18,8 @@ github.com/gofiber/utils v1.1.0 h1:vdEBpn7AzIUJRhe+CiTOJdUcTg4Q9RK+pEa0KPbLdrM=
github.com/gofiber/utils v1.1.0/go.mod h1:poZpsnhBykfnY1Mc0KeEa6mSHrS3dV0+oBWyeQmb2e0=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kettek/apng v0.0.0-20220823221153-ff692776a607 h1:8tP9cdXzcGX2AvweVVG/lxbI7BSjWbNNUustwJ9dQVA=
github.com/kettek/apng v0.0.0-20220823221153-ff692776a607/go.mod h1:x78/VRQYKuCftMWS0uK5e+F5RJ7S4gSlESRWI0Prl6Q=
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
Binary file not shown.
+61
View File
@@ -0,0 +1,61 @@
package main
import (
"archive/zip"
"fmt"
"image"
"io"
"os"
"github.com/kettek/apng"
)
func main() {
filename := "119477424_ugoira600x600.zip"
f, err := os.Create("out.apng")
if err != nil {
panic(err)
}
err = zip2apng(filename, f, 1000, 1000)
if err != nil {
panic(err)
}
}
// APNG spec: https://wiki.mozilla.org/APNG_Specification
// each frame will be delayed (delayNumerator/delayDenominator) seconds
func zip2apng(filename string, w io.Writer, delayNumerator, delayDenominator uint16) error {
// Open a zip archive for reading.
r, err := zip.OpenReader(filename)
if err != nil {
return err
}
defer r.Close()
img_apng := apng.APNG{}
// Iterate through the files in the archive,
// printing some of their contents.
for _, f := range r.File {
fmt.Printf("Contents of %s:\n", f.Name)
rc, err := f.Open()
if err != nil {
return err
}
defer rc.Close()
img, img_format, err := image.Decode(rc)
_ = img_format
if err != nil {
return err
}
frame := apng.Frame{
Image: img,
DelayNumerator: delayNumerator,
DelayDenominator: delayDenominator,
}
img_apng.Frames = append(img_apng.Frames, frame)
}
return apng.Encode(w, img_apng)
}
View File
+3
View File
@@ -0,0 +1,3 @@
xarchiver won't open the file
binwalk -e X.zip does work