InputStream in = null;
ImageRender sr = null;
try {
in = new FileInputStream(new File(dir, bg));
ImageRender rr = new ReadRender(in, true);
sr = new WatermarkRender(rr, createParam(wmDir, wm, alpha, x, y));
write(sr, alpha + "-result-" + bg);
} finally {
if (sr != null) {
sr.dispose();
}