Attempting to convert RAW to JPEG, fails

Asked by:
mjnrock / 5 Points
2014-05-29 10:15 pm EST
Image Editing
If I attempt to resize JPEG to JPEG, it works completely fine. However, when attempting to resize (an convert) a RAW to JPEG, it consistently fails.

function resizeImage($inputURL, $outputURL, $dimensions = Array(1280,720))
exec("/usr/bin/convert {$inputURL} -resize {$dimensions[0]}x{$dimensions[1]} {$outputURL}");
echo filesize($outputURL);

(Obviously, am using my correct username in the real script)
resizeImage("/home/USERNAME/public_html/_photos/images/raw/DSC00806.ARW", "/home/USERNAME/public_html/_photos/images/jpg/1280x720/DSC00806.JPG", array(800,600));

To ask this user for more information, please first login.

To submit an answer, please login.

Wrong line:

resizeImage("/home/USERNAME/public_html/_photos/images/raw/DSC00806.ARW", "/home/USERNAME/public_html/_photos/images/jpg/1280x720/DSC00806.JPG");
5 Points
2014-05-29 10:16 pm EST
I am using a Sony camera, so all of my RAW images are of the .ARW extension, if that matters.
5 Points
2014-05-29 10:20 pm EST

Best answer chosen by User


3,713 Points
2014-05-30 5:49 am EST
Hello mjnrock, and thanks for the questions.

I would be very careful about your CPU usage if you plan on converting a large amount of images on your account. Typically you'd do local batch processing in something like Photoshop or using a program like UFRaw to get your images into a web ready format prior to uploading them to your website.

In regards to why ImageMagick isn't working on the server for converting your .ARW image files, you might need to specify something like this in your command:

convert arw:image.arw image.png

You might find a bit more help in this ImageMagick forum post about ARW files. Also from the ImageMagick site itself in the RAW camera image formats section it mentions this:

"While ImageMagick can handle a large variety of different formats, it does not 'know' how to convert raw camera files, so IM uses the "dcraw" program as a delegate program to convert the raw file into a format that it does understand, either a TIFF (with the '-T' flag) or PNM. Note that it is designed for raw camera images, and not those from, for example, a scanner. The "dcraw" program can handle a large number of different raw formats including those from cameras manufactured by Canon, Fuji, Kodak, Nikon and Sony."

Again I'd probably recommend not using a web server to convert raw images into web-ready formats, but hopefully with this information you might be able to get it to work if it's necessary for your site's function.

- Jacob

To submit a comment on this answer, please first login.

Want to share this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!

Help Center Search

Current Customers

Email: Ticket: Submit a Support Ticket
Call: 877-595-4HUB (4482)
757-416-6627 (Intl.)
Chat: Click To Chat Now

Ask the Community

Get help with your questions from our community of like-minded hosting users and Web Hosting Hub Staff.

Not a Customer?

Get web hosting from a company that is here to help.