How to convert multiple png to one DICOM? ImageMagick? - linux

I am converting DICOM to PNG but i got multiple PNG. I want to convert thos emultiple PNG to one DICOM?
mogrify --adjoin -format dcm PNG-images/0002-*

Related

How to convert PNG/JPEG images to svg with ImageMagick?

It seems that with potrace installed, I can just run magick convert x.png x.svg or magick convert x.jpg x.svg.However this just returns a deformed image in black and white, and I need the svg image to be in full color. Additionally, I really need the file format to be svg because svg images are small and portable, and I don't have a lot of disk space on my server.Does anyone know how to convert png/jpeg to svg while retaining color?

24bit JPEG converted by ImageMagick to base64 inflates the size

I have a problem with a few pictures who are JPEG's when I'm converting them through ImageMagick. Below is the string from ImageMagick. The original image was 8MB, ImageMagick compressed it to 1.833MB and the converted base64 string is over 30MB.
heb_w2500-00-500-4c-hi.jpg=>/tmp/pic_59974.jpg JPEG 358x640=>84x150 8-bit sRGB 1.833MB 0.100u 0:00.029
I've tried different version and they all work except when it's a 24bit JPEG.

Converting Svg with base64 encoded png in it

I'm trying to convert a Svg file which has a base64 encoded png in it.
Im trying to convert the file from svg to png using Imagemagick.
The problem being that the Svg converts (all the pure svg elements ie. text and such) but the png in the svg disappears.
Originaly i had alot of params added to the conversion but when i realized it wasn't working i striped it down to just this command:
convert /www/data/svg/201.svg /www/data/png/201.png
Original SVG:
201.svg
Result:

flatten images with transparency in PDF

How to flatten images in PDF files with transparency?
convert PDF to PS (postscript)
pdftops input.pdf output.pdf.ps
If a PDF file contains eg. PNG files with alpha channel (transparency) the PDF is rendered/rasterized to an image and that is not a solution because then you lose the plain text in the file
Is there a tool (linux command line) to flatten images in PDF files with transparency?
Its not clear why you want to do this. If you want PostScript then Ghostscript can produce PostScript for you from a PDF file (use the ps2write device). Obviously transparency will have to be rendered to an image, in which case the resolution is important. The default is 720 dpi which is probably higher than you might need.
Note that a PDF file can't contain a PNG, that's not a possible image type in PDF. A PNG would have to be stored as an image with a separate alpha.

How to write a bash script that cuts images into pieces using image magick?

I have a number of input images that contain multiple smaller images, all of them in a single row. All the contained images are the same size. So, for example, the image input.png may be 480x48 and contain 10 48x48 images, all in one row.
Using the imagemagick convert tool (or any other tool supplied with the defaul imagemagick suite), I want to write a bash script that takes an input image, the number of images to cut, and then cuts them all into individual images.
The user interaction i can do, but I've not been able to get convert to do the actual cutting. Can anyone suggest something? From reading the manual pages, i think this should work:
convert 'input.png[0x0+48+48]' output.png
but I get an error:
convert: no pixels defined in cache
tb_icons_l.png' #
magick/cache.c/OpenCache/3572.
convert: No IDATs written into file
1.png' #
coders/png.c/PNGErrorHandler/1391.
Any ideas?
I would do it like that:
convert input.png -crop 48x48 +repage +adjoin output_%02d.gif
Read more at Tile Cropping, in ImageMagick documentation.
I believe you've got the position and size swapped. Try:
convert 'input.png[48x48+0+0]' output.png
The third image would be:
convert 'input.png[48x48+96+0]' output.png
Or
convert 'input.png[48x48+0+96]' output.png

Resources