var page = require("webpage").create();
var system = require("system");

page.paperSize = {
    width: '6in',
    height: '4in',
    margin: {
        top: '10px',
        left: '15px',
        right: '15px',
        bottom: '10px'
    }
}

page.zoomFactor = 0.4;

page.viewportSize = {
  width: 600,
  height: 650
};
    
page.open(system.args[1], function (status) {
    window.setTimeout(function () {
        var size = page.evaluate(function () {
              return {width: width = 576, height : 384 };
        });
        page.paperSize = size;

        page.render(system.args[2]);
        phantom.exit();
    }, 3000);
});

page.onError = function(msg, trace) {
    console.log(msg);
}
@@ -268,17 +268,17 @@
 tor = 0.
-4
+6
 ;%0D%0A%0D%0Apag
@@ -335,14 +335,10 @@
 %7D;%0D%0A
-    
 %0D%0A
+
 page
@@ -540,40 +540,8 @@
 %7D);%0D
-%0A        page.paperSize = size;%0D
 %0A%0D%0A 
@@ -682,13 +682,15 @@
 .log(msg);%0D%0A
-
 %7D
+%0D%0A

Update rasterize.js