Create a macro/script to stitch whole slide images

Can you help me to develop a script/macro in ImageJ to automatically perform image stitching and save the stitched image in jpg/stacked tiff files