python pdf to png code example
Example 1: python pdf to image
pip install pdf2image
from pdf2image import convert_from_path
pages = convert_from_path('pdf_file', 500)
for page in pages:
page.save('out.jpg', 'JPEG')
Example 2: png to pdf
$images = array("your-file.png");
$pdf = new Imagick($images);
$pdf->setImageFormat('pdf');
$pdf->writeImages('output-file.pdf', true);
Example 3: Python convert dcm to png
med2image -i SAG-anon/0001-1.3.12.2.1107.5.2.19.45152.2013030808110258929186035.dcm \
-d dicom-results/tags \
-o %PatientName%PatientID%ProtocolName.jpg \
-s m