B4J Question Image file formats supported using output stream

canalrun

Well-Known Member
Licensed User
Longtime User
Hello,
I am basically using the following code to write an image to a file:

B4X:
  Dim ops As OutputStream = File.OpenOutput(ofd, ofn, True)

  can.snapshot.WriteToStream(ops)       
  ops.Close

Where can is a canvas and my output filename, ofn, has the .jpg extension. I seem to be getting JPEG files output. I see the docs mention PNG's, I suppose if I used a .png extension.

Are other file formats supported, for example Tiff if I use a .tiff file name extension?

Thanks,
Barry.
 

canalrun

Well-Known Member
Licensed User
Longtime User
Thanks. Yes, I thought I was getting JPEG's, but I found a file type checker and it reported that the images are in fact PNG's.

There are quite a few posts in these forums about a Java library, imageio. The posts mention using JavaObject to access the library. Is that the preferred access method?

I assume that imageio is a Java jar that I must download from somewhere.

Barry.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…