Page 1 of 1
Any image to PNG
Posted: 2015-12-02T14:55:33-07:00
by doublemax
Hello,
Is there a single command line to convert any image to a PNG?
`display` works for all images we have tried - but `convert` did not.
We have problems with multiple layer images. Testcase:
wget "
http://doppelbauer.name/psd-layers.psd"
convert -coalesce "psd-layers.psd" -background none -flatten single-layer.png
convert -coalesce "psd-layers.psd" -background none multiple-layer.mng
display "psd-layers.psd" : works
display "single-layer.png" : failed - white image
display "multiple-layer.mng" : works
Thanks a lot!
Re: Any image to PNG
Posted: 2015-12-02T15:08:09-07:00
by fmw42
What IM version and platform are you on? Please always provide that.
What do you get from
does it include the png delegate library?
What is not working about the png result? Are you trying to get a transparent background? If the png file has no transparency, then just using -background none -flatten or just -background none will not change that. You need to use -transparent somecolor, where somecolor is the color you want to change to transparent.
Can you post your input image to some free hosting such as dropbox.com and put the URL here so we can test with it?
Also note that -coalesce is not likely to affect psd files as they are not optimized as in gif and if used, it should appear after the input image.
Re: Any image to PNG
Posted: 2015-12-02T15:22:43-07:00
by doublemax
Thanks a lot,
My problem: The "flatten" image is simply white.
Goal: A commandline "Uploaded image goes in - image for everyone (=png/jpeg) comes out".
Testcase:
Commandline:
convert "psd-layers.psd" -flatten "test.png"
display test.png
Version:
Thanks!
Re: Any image to PNG
Posted: 2015-12-02T15:49:56-07:00
by fmw42
In most cases, a flattened layer of the PSD file is the first layer. So for PSD files you should be able to use
Code: Select all
convert psd-layers.psd[0] psd-layers.png
That works for me on IM 6.9.2.7 Q16 Mac OSX. Adding [0] to any non-layered file will not hurt, since the first layer [0] is the only layer.
However, note that Imagemagick does not generally know about all the "fancy" layers in a PSD file. (Yours has many of these, but they do not seem to be doing anything to the base image.) It only can handle simple layers. So you may not be able to extract other individual layers.
If the above does not work, then check your version of libpng.