     in: ['path']
     params: ['width', 'height']
     out: ['canvas']
+    async: true
     forwardGroups: true
-  , (payload, groups, out) ->
-    width = if c.params.width? then c.params.width else null
-    height = if c.params.height? then c.params.height else null
-    if width is null and height is null
+  , (payload, groups, out, callback) ->
+    width = c.params.width
+    height = c.params.height
+    if not width? and not height?
       width = 256
     path = payload
     try
       inputBuffer = sharp path
       inputBuffer.metadata (err, metadata) ->
         if err
-          throw err
+          return callback err
         inputBuffer
         .resize width, height
         .withMetadata()
+        .withoutEnlargement()
         .toBuffer (err, outputBuffer, info) ->
           if err
-            throw err
+            return callback err
           # Create image with buffer as src
           image = new Canvas.Image
           image.src = outputBuffer

          canvas.originalWidth = metadata.width
          canvas.originalHeight = metadata.height
          out.send canvas
    catch err
      out.error err

  c

  c = new noflo.Component

  c.icon = 'expand'
  c.description = 'Resize a given image to the new dimension'

  c.inPorts.add 'path',
    datatype: 'string'
