Cliff and others,
It makes sense when I look at what you are doing and when I make random 4 x6 x1 
matrices I am able to deal with them as images without a problem.  I tried 
adding a trailing axis of length 1 and I called it FINAL_IMAGE.  see the code 
below:

ID600x600x1=: 600 600 1 $ 1 , zeros6 NB. 600 zeros appended
   
   $ID600x600x1
600 600 1
   
   view_image ID600x600x1
600 600 1
   
   FINAL_IMAGE=:FINAL dot ID600x600x1
   
   $FINAL_IMAGE
400 600 1
   
   BW256 view_data FINAL_IMAGE NB. This is exactly what I want as a JPEG
600 400
   
   view_image FINAL_IMAGE  NB. Not working properly
400 600 1
   
NB. and these are the following errors I received:

   (,:"1 FINAL_IMAGE) write_image 'imagefilename.jpg'
|domain error: memw
|   (,m)    memw addr,0,sz
   
   85 0 1 (,:"0 FINAL_IMAGE) write_jpeg 'test_image.jpg'
|domain error: memw
|   (,m)    memw addr,0,sz

Do the errors I recieved help?  If not, I just attached my code.

Sorry if it is against forum rules to attach my code or files.  It should 
operate on any 400x600 image, the one I used was 
just named lion.jpg

Brandon

*******************************************************************************************
image3 has 4 allowed image data types, but matrices are not on the list 
for images; view_image adds one more type (filenames)

http://ww2.lafayette.edu/~reiterc/j/image3help/image3.html

view_data is more ad hoc, better to work with view_image and write_image 
etc.

Add a trailing axis of length 1 is what you need, I think

(,:"1 FINAL) write_image 'imagefilename.jpg'
or

85 0 1 (,:"1 FINAL) write_image 'imagefilename.jpg'
should work
.
.
.
.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to