You can use gh-md-to-html for this, which is a command line tool that can also convert markdown to pdf (Full disclosure: I'm the author).
You can install it by installing wkhtmltopdf and then installing gh-md-to-html with
pip3 install gh-md-to-html[pdf_export]
And then use
gh-md-to-html path_to_your_file.md -p <name>.pdf
The -p option declares under which file name to save the resulting pdf file; the "<name>" is automatically replaced with the name of your input file.
Under to hood, gh-md-to-html converts the file to html (as the name suggests) and then from html to pdf using wkhtmltopdf.
The resulting pdf file is, in any case, styled similar to how GitHub styles their README files; if you want to disable that, you can supply the option -s false to the command, which disables the default styling.
The conversion process is done partially online (using GitHub's markdown REST API); in case you don't want that, you can use pip3 install gh-md-to-html[offline_conversion] and then run gh-md-to-html with the -o OFFLINE option.
gh-md-to-html can handle a variety of different input sources (repositories, weblinks, local files, strings) and resolves image addresses dependent on the input source, so there really shouldn't be any cases of generated pdf files missing images with it. There is a table in the project's README that dives further into this, though, if you need some additional documentation.