Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagemagick force output fileformat

Tags:

imagemagick

I want to convert a png-image to a jpg image in imagemagick.

Usually I would use this command:

convert image.png image.jpg

This works since imagemagick determins the output format by looking at the file extension '.jpg'. Is there any commandline option for imagemagick to override this behaviour?

I would like to use something like this

convert image.png -outputformat jpg image.data

It is important for my application, that no *.jpg file is ever created in the process, so I can't "mv" it afterwards either!

like image 549
Nils Ziehn Avatar asked Nov 12 '13 15:11

Nils Ziehn


2 Answers

I just found the solution:

convert image.png jpg:image.data

The jpg: is not written!

like image 120
Nils Ziehn Avatar answered Oct 29 '22 03:10

Nils Ziehn


You are looking for the -format option: http://www.imagemagick.org/script/command-line-options.php#format

like image 20
dlemstra Avatar answered Oct 29 '22 03:10

dlemstra