Diff
diff --git a/cstyle/transformers/image/main.go b/cstyle/transformers/image/main.go
index 1533515..667c10c 100644
--- a/cstyle/transformers/image/main.go
+++ b/cstyle/transformers/image/main.go
@@ -5 +4,0 @@ import (
- "grim/canvas"
@@ -21,0 +21 @@ func Init() cstyle.Transformer {
+ // !TODO: Needs to find crop bounds for X
@@ -23,2 +23,3 @@ func Init() cstyle.Transformer {
- if !c.Adapter.Library.Check(n.Properties.Id + "canvas") {
- i, err := c.Adapter.FileSystem.ReadFile(filepath.Join(c.Path, n.Src))
+ i, err := c.Adapter.FileSystem.ReadFile(filepath.Join(c.Path, n.Src))
+ if err == nil {
+ img, _, err := image.Decode(bytes.NewReader(i))
@@ -26,12 +27,3 @@ func Init() cstyle.Transformer {
- img, _, err := image.Decode(bytes.NewReader(i))
- if err == nil {
- width, height := n.Style["width"], n.Style["height"]
- if n.Style["width"] == "" {
- width = strconv.Itoa(img.Bounds().Dx()) + "px"
- }
- if n.Style["height"] == "" {
- height = strconv.Itoa(img.Bounds().Dy()) + "px"
- }
- ctx := n.GetContext(img.Bounds().Dx(), img.Bounds().Dy())
- n.Style["width"], n.Style["height"] = width, height
- ctx.DrawImage(img, 0, 0)
+ width, height := n.Style["width"], n.Style["height"]
+ if n.Style["width"] == "" {
+ width = strconv.Itoa(img.Bounds().Dx()) + "px"
@@ -39,13 +31,6 @@ func Init() cstyle.Transformer {
- }
- } else {
- img, _ := c.Adapter.Library.Get(n.Properties.Id + "canvas")
- width, height := n.Style["width"], n.Style["height"]
- if n.Style["width"] == "" {
- width = strconv.Itoa(img.Bounds().Dx()) + "px"
- }
- if n.Style["height"] == "" {
- height = strconv.Itoa(img.Bounds().Dy()) + "px"
- }
- n.Style["width"], n.Style["height"] = width, height
- n.Canvas = &canvas.Canvas{
- RGBA: img,
+ if n.Style["height"] == "" {
+ height = strconv.Itoa(img.Bounds().Dy()) + "px"
+ }
+ ctx := n.GetContext(img.Bounds().Dx(), img.Bounds().Dy())
+ n.Style["width"], n.Style["height"] = width, height
+ ctx.DrawImage(img, 0, 0)
@@ -54 +38,0 @@ func Init() cstyle.Transformer {
-