Convert RAW photos to JPEG in linux/php

Actually, as you can see in this list, ImageMagick does support RAW photos: http://www.imagemagick.org/script/formats.php (e.g. .NEF nikon photos and .CR2 canon photos).

Example code for a .CR2 photo:

$im = new Imagick( 'source.CR2' );
$im->setImageFormat( 'jpg' );
$im->writeImage( 'result.jpg' );
$im->clear();
$im->destroy();

Even easier to sudo apt-get install ufraw ufraw-batch

then either use ufraw (see man pages) or use Imagemagic which uses ufraw

convert mypic.RAF mypic.jpeg