Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a "raw file" (not unprocessed image data, but raw heightmap data from a game's map editor saved as Photoshop RAW) and it looks like XnView might be able to open it.

It sees the properties as 513x513 8-bit RGB when in reality it is a 513x513 single channel 16 bit file with IBM PC byte order and no header. How do i force it to read it this way?

share|improve this question
    
Are you asking how to associate .raw to open with XnView? –  JFV Jul 26 '09 at 14:37
    
no, it's trying to open a .raw file a particular way and i'm trying to override it. –  RCIX Jul 26 '09 at 14:41
    
So, XnView is trying to open .raw files a certain way, but you want it to open it another way? –  JFV Jul 26 '09 at 14:44
    
right! ()()()() –  RCIX Jul 26 '09 at 14:48

1 Answer 1

Convert it with imagemagick to format XnView can read.

I can be difficult to preserve the 16 bit depth however. You will have to find a suitable format that can represent the depth and can be exported by imagemagick and imported by XnView.

As a start I would try TIFF, it supports 16 bit and is supported by imagemagick as well as XnView. The conversion will blow up the single channel into three channels with identical values.

To read you file in imagemagick you'll probably have to use the following options:

     GRAY   Raw gray samples  	
               Use -size and -depth to specify the image 
               width, height, and depth.

Try:

convert -endian LSB -size 513x513 -depth 16 gray:image image.tiff

Convert back to 16 bit single channel:

convert image.tiff -depth 16 -type grayscale gray:image
share|improve this answer
    
I tried imagemagick and it doesnt work on the file i need sadly :( –  RCIX Aug 3 '09 at 10:44
    
You'll have to tell imagemagick the size and depth of your image, because it can't detect them from raw images. I have added the options to the answer. –  Ludwig Weinzierl Aug 3 '09 at 11:17
    
Hmm i tried that command but it didnt seem to work. Also, i'll need to be able to convert both ways. –  RCIX Aug 3 '09 at 11:50
    
I'm pretty convinced there is a way with imagemagick: Would it be possible for you to upload an example file? –  Ludwig Weinzierl Aug 3 '09 at 11:55
    
Tried it with an example and it worked very well except that it has to be gray instead of grey. –  Ludwig Weinzierl Aug 3 '09 at 12:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.