This project has moved. For the latest updates, please go here.

Trying to clip a raster

May 29, 2016 at 11:00 PM
I'm trying to create a set of image tiles from a single, large raster. It seems like a simple enough task but I can't work out the correct commands to use for clipping. I can see the clip command for the MagicImage object but I can't work out how to set the actual clipping rectangle I need.
May 29, 2016 at 11:39 PM
I managed to work it out. Here's how I did it if anyone is interested:
        Dim inImage As MagickImage = New MagickImage(inImagePath)
        Dim outImage As MagickImage = New MagickImage(Color.White, 1000, 1000)
        Dim outGeom As MagickGeometry
        Dim XStart as Integer = 0
        Dim YStart as Integer = 0
        Dim cellWidth as integer = 1000
        Dim cellHeight as integer = 1000
        outGeom= New MagickGeometry(New Rectangle(XStart, YStart, cellWidth, cellHeight))
        outImage.CopyPixels(inImage, outGeom, 0, 0)