You can check the type of the array with 3!:1
(see the 3!: foreign conjunctions)
and
3!:0 ID600x600x1
1
means that ID600x600x1 is Boolean (not integer, not an allowed image3
type. In fact be careful about using image3 in general with 2 color
images (there is a bug with png's with 2 element palette's too).
I don't have access to FINAL data type, so not sure if that is what is
going on. (your attachments were not passed along).
By the way, have you considered using *.png (no loss of info but be sure
to use at least three palette elements and not a Boolean index array).
Grayscale jpegs are not universally supported and there may be future
bumps even if you get image3 working with your data.
[EMAIL PROTECTED] wrote:
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
--
Clifford A. Reiter
Mathematics Department, Lafayette College
Easton, PA 18042 USA, 610-330-5277
http://www.lafayette.edu/~reiterc
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm