Do you mean that you have an image that ECC information has already been embedded in, and you want to run the ECC detection and correction phase and return the corrected image?
If ECC information is not already embedded in the image, then you cannot run detection and correction, just an embedding phase. The embedding phase would make the output larger, and you would have to define where you wanted the extra values to go. The ECC information will not necessarily visually look nice, so you might want to think about moving it to the border. Or you might want to think about computing it as a separate output and then use an image file format such as TIFF or PNG that allowed you to store it as distinct information apart from the main image.