Convert png/JPEG to DICOM format

Hello,

You can do this directly using the REST API of Orthanc, with URI “/tools/create-dicom”. Here is a full sample script in bash:

#!/bin/bash

set -ex

IMAGE=cat Lena.png | base64 -w 0

cat < /tmp/request.json
{
“Tags” : {
“PatientID” : “123”,
“PatientName” : “LENA”,
“StudyDescription” : “FROM^PNG”
},
“Content” : “data:image/png;base64,${IMAGE}”
}
EOF

curl -H ‘Expect:’ http://localhost:8042/tools/create-dicom -d @/tmp/request.json

Note that the integration tests of Orthanc contain more samples (notably to create a DICOM instance from a PDF file):
https://bitbucket.org/sjodogne/orthanc-tests/src/default/Tests/Tests.py

HTH,
Sébastien-