-
Jeff is right, you have a bad OBOE (off by one error).
-
you should always iterate Y first, and then X on the inner loop - this takes advantage of the fact that X pixels are next to each other in memory. Depending on picture size, this can provide a good speedup
-
#pragma DisableBackgroundTasks // always good for tight loops
Here is corrected code:
#pragma DisableBackgroundTasks // this will give you a 2x-10x speedup
for currentY as Integer = 0 to OriginalHeight-1
for currentX as Integer = 0 to OriginalWidth-1
dim theColor as Color = OriginalRGBS.Pixel(currentX, currentY)
ResultRGBS.Pixel(currentX, CurrentY) = HSV(theColor.Hue, theColor.Saturation, theColor.Value * theAmount, theColor.Alpha)
next
next
I suspect what’s happening is that with some picture sizes, the OBOE is causing a silent internal fault, but with some picture sizes it’s OK?