You'd better included the exception message along with stack trace, but I
bet it's this one:
java.awt.HeadlessException: No X11 DISPLAY variable was set, but this
program performed an operation which requires it.
Well although headless API can do much of the graphics logic without
really having one, but don't except it to draw the image too :)
IMHO your problem is because you've tried to draw this image on a new
JFrame (which does not exist in fact). I'm not sure if that line
(drawImage) is necessary any more (since you've already defined your new
image's width and height) but if really needed, it should be replaced by
another command avoiding to draw it.