canalrun Well-Known Member Licensed User Longtime User Jan 16, 2016 #1 Hello, I am basically using the following code to write an image to a file: Code: 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.
Hello, I am basically using the following code to write an image to a file: Code: 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.
LucaMs Expert Licensed User Longtime User Jan 16, 2016 #2 canalrun said: Are other file formats supported, for example Tiff if I use a .tiff file name extension? Click to expand... When I have a question like that, I try However, it seems to me that these are the supported formats: https://docs.oracle.com/javase/7/docs/api/javax/imageio/package-summary.html Upvote 0
canalrun said: Are other file formats supported, for example Tiff if I use a .tiff file name extension? Click to expand... When I have a question like that, I try However, it seems to me that these are the supported formats: https://docs.oracle.com/javase/7/docs/api/javax/imageio/package-summary.html
canalrun Well-Known Member Licensed User Longtime User Jan 16, 2016 #3 LucaMs said: When I have a question like that, I try However, it seems to me that these are the supported formats: https://docs.oracle.com/javase/7/docs/api/javax/imageio/package-summary.html Click to expand... Thanks for the pointer to imagio. If I search the forums for "B4J imagio", I get quite a few matches. I will have to look at these more carefully. Barry. Upvote 0
LucaMs said: When I have a question like that, I try However, it seems to me that these are the supported formats: https://docs.oracle.com/javase/7/docs/api/javax/imageio/package-summary.html Click to expand... Thanks for the pointer to imagio. If I search the forums for "B4J imagio", I get quite a few matches. I will have to look at these more carefully. Barry.
Erel B4X founder Staff member Licensed User Longtime User Jan 17, 2016 #4 Only PNG is supported. Upvote 0
canalrun Well-Known Member Licensed User Longtime User Jan 17, 2016 #5 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
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.
Erel B4X founder Staff member Licensed User Longtime User Jan 17, 2016 #6 I'm not familiar with this library so I don't know... Upvote 0
canalrun Well-Known Member Licensed User Longtime User Jan 18, 2016 #7 I found a solution in these forms. It converts a PNG file to a JPEG: https://www.b4x.com/android/forum/threads/save-canvas-in-jpg.42839/#post-259751 Thanks. Upvote 0
I found a solution in these forms. It converts a PNG file to a JPEG: https://www.b4x.com/android/forum/threads/save-canvas-in-jpg.42839/#post-259751 Thanks.