This project has moved and is read-only. For the latest updates, please go here.

Trying to clip a raster

May 30, 2016 at 12:00 AM
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 30, 2016 at 12:39 AM
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)
        outImage.Write(outImagePath)