Blank JPEG's using NT & D5

I wrote a program that reads a JPEG images,
resizes it and then saves it back to disk. Using
win98 all works fine. However, when I run the
program under NT4 all my program writes are black
images!!! Does anyone have a clue how to fix this

It looks like the problem is in:

Thanks already surferbertus.

Sent via
Before you buy.