I have an raster file in my server space, which has the same projection as my webmap, and I would like to crop the image by passing the visible extent of a webmap. I think the cropping function is easily possible via a python script server side, but the process of converting the map envelope coordinates to a bounding box the script could use to cut the image to that exact extent is beyond me at the moment. Any ideas, methods, or general roadmap would be helpful.
In a nutshell, I am trying to reproduce the "export" functionality of an ESRI map service without using ArcServer.
Like this: http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/export?bbox=-9562211.80152863,4584479.44244939,-9519931.21541649,4626760.02856153&size=1024,1024&format=jpg&imageSR=102100&bboxSR=102100&f=image
Am I crazy or what?