Thanks Cliff, I tried incorporating your example into my case but I am still
having troubles.
I will try to be more specific this time around:
I have two matrices, one is 2 dimensional and the other is 3 dimensional.
I can only view both as data (not as images). Here are my specific examples:
$FINAL NB. This is my 2 dimensional Matrix
400 600
BW256 view_data FINAL NB. This works fine and displays to screen
600 400
view_image FINAL NB. This does not display anything to the screen
400 600
My preference would be to save the above (FINAL) as a jpeg. My 3 dimensional
matrix does the same thing as above, I can display it using view_data but not
as view_image.
It is strange because working on a much smaller scale:
m1=: 4 6 $ 34 65 76 76 23
$m1
view_image m1 NB. this does not work as expected
view_data m1 NB. This DOES work, as expected
m2=: 4 6 1 $ 23 200 202 58
$m2
view_image m2 NB. Yet, this works which contradicts my troubles above.
Thanks for any help!
Brandon
-------------- Original message ----------------------
From: Cliff Reiter <[EMAIL PROTECTED]>
> This works for me:
>
> load '~addons\media\image3\view_m.ijs'
> view_image BW256;p=:512#,:2#i.256
> 512 512
> 85 0 1 (,:"0 p) write_jpeg fn=:'c:\temp\test_image.jpg'
> 7578
> view_image fn
> 512 512
>
> Does this give you a starting point? Ask with a more specific
> example of the problem if not.
> Best,
> Cliff
>
> [EMAIL PROTECTED] wrote:
> > Hello everyone, this is my first product/experience in J and I have really
> enjoyed it thus far. I am running into a roadblock that I just can't seem to
> figure out.
> >
> > I have the Image3 addon and with it I have converted some of my own JPEG
> images into a 400x600x1 grayscale image then down to a 400x600 matrix to do
> some
> filtering and matrix manipulations. I am able to get the final product back
> into a 400x600x1 grayscale array I suppose and I can view it using view_data
> but
> I just can't seem to save it as a JPEG properly.
> >
> > So let's say I have my 400x600x1 grayscale data called FINAL . Below is
> script I found in the Image3 addon help section, and I believe this is what I
> need to use but I just can't seem to incorporate it properly. Can anyone
> give
> me a hand?
> >
> > I have been trying things like
> >
> > FINAL mem_to_jpeg ('testimage.jpg', ???, ???)
> > and
> > [100] FINAL write_jpeg 'testimage.jpg'
> >
> > I'm lost, here is the Script:
> >
> > NB. data mem_to_jpeg (file_name; JPEG_RGB; qaulity_default)
> > NB. [jpeg_quality] data write_jpeg filename
> > NB. data may be raw or integer matrices of
> > NB. rgb-triples (color) or single items (grayscale)
> > write_jpeg=: 1 : 0
> > (jpeg_quality,progressive,gray_scaling) m write_jpeg y
> > :
> > 'jq pr gs'=.x,(#x)}.jpeg_quality,progressive,gray_scaling
> > if. 32=(3!:0) m do. m=.{~&>/m end.
> > if. 2 = $$m do. m=.,"0 m end. NB. make rank 3
> > if. 4=(3!:0) m do. m=.m{a. end. NB. make it raw
> > select. gs
> > case. _1 do. if. 1={:$m do. m=.3#"1 m end.
> > case. 0 do. ''
> > case. 1 do. if. 3={:$m do. m=.,@<.@(+/%#)"1&.(a.&i.) m end.
> > case. 2 do. if. 3={:$m do.
> > if. (-:1&|."1)m do. m=.,@{."1 m end. end.
> > end.
> > if. -. 1 3 e.~ {:$m do. 'unsupported 3rd axis length' return. end.
> > sz=. */$m
> > addr=.mema sz
> > (,m) memw addr,0,sz
> > a=.>{.'mem_to_jpeg + i *c i i i i i i' zjm (y;addr),(;/ 1 0 2 {$m),(jq;pr)
> > memf addr
> > if. _1=a do. 'error writing inside dll...' return. end.
> > fsize y
> > )
> >
> > Thank you!
> > ----------------------------------------------------------------------
> > 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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm