chore: started working #36 and closes #12

This commit is contained in:
2023-10-06 12:13:19 +01:00
parent 16a6ae844b
commit 8d5f2a829a
10 changed files with 299 additions and 290 deletions

View File

@@ -25,10 +25,6 @@ func testImgForModel(c *Context, model *BaseModel, path string) (result bool) {
c.Logger.Errorf("Failed to decode image for model with id %s\nErr:%s", model.Id, err)
return
}
if format != "png" {
c.Logger.Errorf("Found unkown format '%s' while testing an image\n", format)
return
}
var model_color string
@@ -36,10 +32,11 @@ func testImgForModel(c *Context, model *BaseModel, path string) (result bool) {
width, height := bounds.Max.X, bounds.Max.Y
switch src.ColorModel() {
case color.Gray16Model:
fallthrough
case color.Gray16Model: fallthrough
case color.GrayModel:
model_color = "greyscale"
case color.YCbCrModel:
model_color = "rgb"
default:
c.Logger.Error("Do not know how to handle this color model")
@@ -47,8 +44,6 @@ func testImgForModel(c *Context, model *BaseModel, path string) (result bool) {
c.Logger.Info("Color is rgb")
} else if src.ColorModel() == color.NRGBAModel {
c.Logger.Info("Color is nrgb")
} else if src.ColorModel() == color.YCbCrModel {
c.Logger.Info("Color is ycbcr")
} else if src.ColorModel() == color.AlphaModel {
c.Logger.Info("Color is alpha")
} else if src.ColorModel() == color.CMYKModel {
@@ -69,5 +64,10 @@ func testImgForModel(c *Context, model *BaseModel, path string) (result bool) {
return
}
if format != model.Format {
c.Logger.Warn("Image format does not match model", format, model.Format)
return
}
return true
}