Page 1 of 1

how can convert .raw to .jpeg or another format ?

Posted: 2018-03-30T19:56:57-07:00
by gh5555
hi all ,

I want to convert the images in AR dataset from .raw to .jpeg format

This is dataset http://www2.ece.ohio-state.edu/~aleix/ARdatabase.html

When I use this code :

convert -size 768X576 -depth 8 rgb:m-001-1.raw m-001-1.jpeg

the conversion is successful but the image is 768X576 and there are 6 sub-images (all identical) within this image. it suppose contains only one RGB image

images in AR dataset are 24 bit depth, but when I replace the 8 with the 24, the
conversion fails.


please what is the right command ?

also I want to convert all images in directory in one command , how can I ?

thanks ,

Re: how can convert .raw to .jpeg or another format ?

Posted: 2018-03-31T02:09:21-07:00
by snibgo
The linked website says "Images are of 768 by 576 pixels and of 24 bits of depth." This probably means the images have three channels, with 8 bits/channel. IM's "-depth" setting is bits per channel, so "-depth 8" is correct.

I don't know why you get 6 images.

To convert all images in a directory, put the convert (or magick) command inside a shell "for" loop.

Re: how can convert .raw to .jpeg or another format ?

Posted: 2018-03-31T02:45:18-07:00
by gh5555
Thanks for your response Mr Snibgo

How do I put a command inside a shell "for" loop ?

I am using Win10

Re: how can convert .raw to .jpeg or another format ?

Posted: 2018-03-31T03:09:09-07:00
by snibgo
Type "help for" at the command line. For example:

Code: Select all

for %F in (*.raw) do magick -size 768X576 -depth 8 rgb:%F outdir\%~nF.png
JPEG is lossy, so I save to PNG instead. I save the outputs to another directory, which must already exist.

If you use Windows BAT scripts, double every %.

Re: how can convert .raw to .jpeg or another format ?

Posted: 2018-03-31T03:21:37-07:00
by gh5555
thank you so much

but how can I fix the problem of converting images to 6 sub-images?

Re: how can convert .raw to .jpeg or another format ?

Posted: 2018-03-31T03:34:48-07:00
by snibgo
To answer that I would have to see a sample input file. The linked website claims to link to an example, but the link is broken. It says the full database is available but I need a university email to apply for a password, and each tar is 100 MB which is too large for me to download.

The simple answer is probably to delete the five unwanted images.