Brian Z above provided the below, which is the correct, fully reversible, and lossless (assuming the convert step is in fact lossless, which I think it is or at least ought to be) way to put png's into a pdf. You are required to convert from png to lossless jp2 in order to be compliant with PDF structure / readers (I think).
$ convert sample.png -quality 0 sample.jp2
$ img2pdf -o sample.pdf sample.jp2
However it is worth noting that you can supply the .png files themselves directly to img2pdf like :
$ img2pdf -o sample.pdf sample-page1.png <sample-page2.png ...>
This will produce the smallest pdf file, and will insert the png's raw hex into objects within the pdf losslessly*.
*The drawback, is this process is not reversible unlike using jp2. The header/footer and and chunk header/footer data has been stripped (which actually makes the files even smaller!) from the png that is inserted leaving only the raw picture data (the metadata that was deleted is integrated into the pdf structure), presumably to "hack" the pdf to display raw png which is technically non-compliant with the container. It displays fine in firefox, and may display fine in all modern readers, but if png is non-compliant with the container then strict readers may not render the raw png data (as they should not expect it / process it correctly).
Here you can find an extremely raw bash script that worked for me to extract and reconstruct the png files with matching hashes to the ones used for input into the pdf. https://github.com/jack4455667788/RebuildRawPNGExtractedFromPDF