Image merging function into main plugin.