B4J Question Image quality

focus330

Member
Licensed User
Longtime User
Every test I made, writing an image , gives me always an output quality of 96x96 ppi.
Also reading many threads I don't understand how to write an image with a resolution of 200x200 ppi.
Somebody can help me ?
 

focus330

Member
Licensed User
Longtime User
Erel, I try to understand the error. The code used seems not good for all types of input images depending on how RGB is constroyed. Then considering that reach a code solution with java is very hard to me, I try another way that gives me the correct result.
The logical is: 1 I write the image into a png file
2 Then I used the pngtojpg library published in the community by jota that works fine and hasn't problems with images.
3Then i reload the new file and use the java routine of the code reported to transform from 96x96x to 300x300.

Probably not a beautful solution, but it works.
This is the test code.

B4X:
        Dim png4jpg As pngTojpg
       
        Dim SUF As String
        DateTime.DateFormat = "yyyy_MM_dd HH_ss"
        SUF = DateTime.Date(DateTime.Now)
        SUF = SUF.Replace("/","_")
       
        Dim DirOut As String
        DirOut=File.DirApp
        If PathDirOut.Length > 0 Then
            DirOut = PathDirOut
        End If
   
        'CanvasMain1.SetSize(390,472)
        Dim Out As OutputStream  = File.OpenOutput(DirOut, "Test1.png",False)
        Dim MyIm As Image
        MyIm = CanvasMain1.Snapshot
        MyIm.WriteToStream(Out)
       
        Dim MyNewIm As pngTojpg
        MyNewIm.convert(DirOut & "/Test1.png",DirOut & "/Test1.jpg")

        MyIm.Initializesample(DirOut, "Test1.jpg",390,472)
        Out  = File.OpenOutput(DirOut, SUF & "_FOTO_" & edtName.Text &".jpg",False)
        Enhance3.SaveImage3(MyIm, Out, "300", "01")
        Out.Close

Enhance3 is on the code reported before.

Thanks Erel and thanks to everybody,
 
Upvote 0
Top