add Make collage

This commit is contained in:
2023-08-11 23:20:53 -04:00
parent 846e191582
commit b298cb019d
2 changed files with 87 additions and 15 deletions

View File

@@ -26,12 +26,52 @@ func init() {
}
func TestMake(t *testing.T) {
t.Log("Test was run")
img1f, err := testDataFS.Open("img1.jpg")
if err != nil {
t.Fatalf("opening image failed %v", err)
req := Request{
BackgroundImage: "",
Aspect: Dimension{
Width: 816 * 4,
Height: 528 * 4 * 2,
},
Dimension: Dimension{
Width: 816,
Height: 528 * 2,
},
Photos: []Photo{
{
ImageName: "img1.jpg",
Crop: Rectangle{
Start: Point{
X: 431,
Y: 697,
},
End: Point{
X: 2514,
Y: 2047,
},
},
Frame: Rectangle{
Start: Point{
X: 0,
Y: 0,
},
End: Point{
X: 816,
Y: 528,
},
},
},
},
}
fmt.Printf("%#v\n", img1f)
out, err := os.Create("./test_op.jpg")
if err != nil {
t.Fatalf("failed to create ouput image file %v", err)
}
err = Make(req, testDataFS, out)
if err != nil {
t.Fatalf("failed to make collage %v", err)
}
}
func TestCrop(t *testing.T) {