Trying to embed a pdf into a dcm file by following the below gist. Our viewers don't support embedded pdf yet. The pdf is converted to an image by ghostscript and is 1000k on the disk (multi pages, 150 dpi).
https://gist.github.com/mdubey82/4030263
No matter what I do, fo-dicom
takes a 1000k jpg or png or bmp file and creates a 11 meg dcm file.
Any ideas how to slim that down?
Thanks!
Edit
With lots help, here is a gist that builds a compressed dcm.
https://gist.github.com/WilliamDoman/e2365104f565a3bf9376fcec6609f432
The created DICOM files do not have compressed pixel data. That means that your PDF, which is probably JPEG/JPEG2000 compressed, is being decompressed and is creating a very large DICOM file. You want to look at the ChangeTransferSyntax()
method to recompress the pixel data before saving.
DicomFile file = new DicomFile(dataset);
file.ChangeTransferSyntax(DicomTransferSyntax.JPEGProcess14SV1);
file.Save("dicom.dcm");