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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gh5555
Posts: 4
Joined: 2018-03-30T19:40:40-07:00
Authentication code: 1152

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

Post 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 ,
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
gh5555
Posts: 4
Joined: 2018-03-30T19:40:40-07:00
Authentication code: 1152

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

Post by gh5555 »

Thanks for your response Mr Snibgo

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

I am using Win10
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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 %.
snibgo's IM pages: im.snibgo.com
gh5555
Posts: 4
Joined: 2018-03-30T19:40:40-07:00
Authentication code: 1152

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

Post by gh5555 »

thank you so much

but how can I fix the problem of converting images to 6 sub-images?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply