Would be nice to just use the full variable name here instead of abbreviations: iW = imageWidth and so on. Makes it easier to read further down.