Sed Seyedi

↳ On programming, startups and more.
blog projects about contact

Convert SRW to JPEG in Linux

SRW is Samsung raw format. You could setup your camera to save in this format.

In this post I show you how to convert it back to JPG or some other more popular format.

As it turned out ImageMagick convert does not recognize SRW. Maybe it can convert other Raw formats but not Samsungs you’ll get a similar error if you try ImageMagick:

convert: Invalid TIFF directory; tags are not sorted in ascending order. `TIFFReadDirectoryCheckOrder' @ warning/tiff.c/TIFFWarnings/861.
convert: TIFF directory is missing required "ImageLength" field. `MissingRequired' @ error/tiff.c/TIFFErrors/561.
convert: no images defined `29.jpg' @ error/convert.c/ConvertImageCommand/3210.

Install ufraw

Ufraw is a program that was designed to handle raw formats.

Install it on your Linux computer with your favorite package manager, I guess it’s old enough to be found in most distros repositories.

I just did man ufraw and was amazed at what it can do! It’s not just a convertor.

It can do much more than that but to simply convert your image to jpg you can open the image in ufraw and then save it use the GUI (yes it has a graphical user interface too).

You can also run the following command to save the file using command line, this is my preferred method for converting all my images at once.

But remember that you should also limit the output size or the size your jpg will be huge. Mine is about 60MB.

Here is the command:

ufraw-batch SAM_0029.SRW --shrink=4 --out-type=jpeg --output output.jpg

By using the above command my 60MB image output became 100KB (0.1MB) which is even web ready.

Anyway, now it’s time to convert all images at once. I have 100+ images in one directory. I don’t want to convert each one by one.

for n in *.SRW; do ufraw-batch $n  --shrink=4 --out-type=jpeg --output $n.jpg; done

CD (change directrory) to the folder that contains all the SRW images and then run the above command. It will take care of converting all images.

Also checkout man ufraw for a list of options and effects that it can apply to all images.