imencode/imwrite behave the same, apart from the obvious difference.
to reiterate, you have to use a file format that isn’t lossy. JPEG is lossy. PNG is lossless.
additionally… ImageUtils *utils
, why do you need to instantiate something (singleton?) that ought to be just a bunch of functions in a namespace?