I had got a requirement to create a QR code with a logo at the center, so first I thought it may require some different library.
For experiment, I just put a logo using Illustrator at the center on the provided QR code and the scanner was able to read it. I used black and white both bg below logo, still it was reading correctly.
So my question is: if I put a logo within the center of any QR code, will it work fine or should I use a library for this matter?
All QR codes with an image or logo in the center take advantage of the fact that the QR code contains redundant information so it can still be decoded despite poor image quality or poor printing. This is part of the error correction.
The QR code standard does not have any explicit facility for making room in the center for an image.
Thus, your approach is perfectly fine. Any other QR code library would do the same: generate the QR code and then add an image in the center.
To ensure that the QR code can still be successfully scanned, it is advisable to use the higher error correction levels if possible (level Q or H instead of M or L).