Android Question Convert Json to bitmap image

Makumbi

Well-Known Member
Licensed User
Please help i have this json extract which i would like to convert to bmp and then insert into my app
i wanted to use this code to assign the converted image to the input stream so that it is converted
B4X:
Sub InsertBlob
    'convert the image file to a bytes array
    Dim InputStream1 As InputStream
    InputStream1 = File.OpenInput(File.DirAssets, "BBAALE KIZITO.JPG")
    Dim OutputStream1 As OutputStream
    OutputStream1.InitializeToBytesArray(1000)
    File.Copy2(InputStream1, OutputStream1)
    Dim Buffer() As Byte
    Buffer = OutputStream1.ToBytesArray
    
    'write the image to the database
    SQL1.ExecNonQuery2("INSERT INTO table2 VALUES('smiley', ?)", Array As Object(Buffer))
End Sub
B4X:
[{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ACCOUNTS","Mid":22,"Ends":41,"Grade":"C4","Term":"TERM1","Years":"2019","Total":63,"pHOTOS":[21,28,50,0,2,0,0,0,22,0,8,0,20,0,42,0,255,255,255,255,80,97,99,107,97,103,101,114,32,83,104,101,108,108,32,79,98,106,101,99,116,0,80,97,99,107,97,103,101,0,1,5,0,0,2,0,0,0,8,0,0,0,80,97,99,107,97,103,101,0,0,0,0,0,0,0,0,0,26,168,0,0,2,0,98,98,97,97,108,101,32,107,105,122,105,116,111,46,106,112,103,0,68,58,92,80,82,79,74,69,67,84,83,32,65,78,68,82,79,73,68,92,83,81,76,92,83,81,76,92,70,105,108,101,115,92,98,98,97,97,108,101,32,107,105,122,105,116,111,46,106,112,103,0,0,0,3,0,54,0,0,0,67,58,92,85,115,101,114,115,92,77,65,75,85,77,66,73,92,65,112,112,68,97,116,97,92,76,111,99,97,108,92,84,101,109,112,92,98,98,97,97,108,101,32,107,105,122,105,116,111,46,106,112,103,0,146,166,0,0,255,216,255,225,21,56,69,120,105,102,0,0,73,73,42,0,8,0,0,0,16,0,0,1,3,0,1,0,0,0,160,15,0,0,1,1,3,0,1,0,0,0,184,11,0,0,2,1,3,0,3,0,0,0,206,0,0,0,6,1,3,0,1,0,0,0,2,0,0,0,14,1,2,0,32,0,0,0,212,0,0,0,15,1,2,0,6,0,0,0,244,0,0,0,16,1,2,0,25,0,0,0,250,0,0,0,18,1,3,0,1,0,0,0,1,0,0,0,21,1,3,0,1,0,0,0,3,0,0,0,26,1,5,0,1,0,0,0,19,1,0,0,27,1,5,0,1,0,0,0,27,1,0,0,40,1,3,0,1,0,0,0,2,0,0,0,49,1,2,0,28,0,0,0,35,1,0,0,50,1,2,0,20,0,0,0,63,1,0,0,19,2,3,0,1,0,0,0,2,0,0,0,105,135,4,0,1,0,0,0,84,1,0,0,164,4,0,0,8,0,8,0,8,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,67,97,110,111,110,0,67,97,110,111,110,32,80,111,119,101,114,83,104,111,116,32,65,51,49,48,48,32,73,83,0,192,198,45,0,16,39,0,0,192,198,45,0,16,39,0,0,65,100,111,98,101,32,80,104,111,116,111,115,104,111,112,32,67,83,53,32,87,105,110,100,111,119,115,0,50,48,49,53,58,49,49,58,50,52,32,49,53,58,51,53,58,51,52,0,0,32,0,154,130,5,0,1,0,0,0,218,2,0,0,157,130,5,0,1,0,0,0,226,2,0,0,39,136,3,0,1,0,0,0,200,0,0,0,0,144,7,0,4,0,0,0,48,50,50,49,3,144,2,0,20,0,0,0,234,2,0,0,4,144,2,0,20,0,0,0,254,2,0,0,1,145,7,0,4,0,0,0,1,2,3,0,2,145,5,0,1,0,0,0,18,3,0,0,1,146,10,0,1,0,0,0,26,3,0,0,2,146,5,0,1,0,0,0,34,3,0,0,4,146,10,0,1,0,0,0,42,3,0,0,5,146,5,0,1,0,0,0,50,3,0,0,6,146,5,0,1,0,0,0,58,3,0,0,7,146,3,0,1,0,0,0,5,0,0,0,9,146,3,0,1,0,0,0,16,0,0,0,10,146,5,0,1,0,0,0,66,3,0,0,134,146,7,0,8,1,0,0,74,3,0,0,0,160,7,0,4,0,0,0,48,49,48,48,1,160,3,0,1,0,0,0,1,0,0,0,2,160,4,0,1,0,0,0,95,1,0,0,3,160,4,0,1,0,0,0,173,1,0,0,5,160,4,0,1,0,0,0,108,4,0,0,14,162,5,0,1,0,0,0,82,4,0,0,15,162,5,0,1,0,0,0,90,4,0,0,16,210,30,137,245,253,63,179,78,98,188,169,183,169,203,253,150,45,146,226,225,23,201,52,197,173,216,170,31,80,250,183,212,103,250,205,61,14,7,212,173,58,83,223,191,134,3,93,89,70,239,102,15,107,195,130,214,181,239,203,175,249,211,48,37,229,244,187,248,95,8,85,219,126,63,103,223,36,60,144,89,102,137,245,47,168,175,213,77,69,127,122,88,0,252,251,242,2,187,230,100,42,182,116,186,142,46,47,82,63,36,210,236,85,216,171,177,87,98,174,197,93,138,187,21,118,42,149,249,153,188,196,52,137,199,151,210,7,212,138,176,137,174,28,168,93,186,168,10,193,223,249,21,218,52,229,246,219,39,143,134,253,76,241,240,223,171,147,228,89,62,177,234,77,207,152,127,85,125,90,212,183,218,239,95,127,181,149,102,226,189,249,61,118,15,160,87,210,218,253,175,249,232,220,105,242,218,153,9,116,110,143,55,47,65,211,236,167,95,14,88,3,97,181,237,94,45,95,179,201,235,255,0,4,181,201,37,167,254,241,233,246,120,201,211,232,174,20,239,75,7,236,242,251,85,126,63,205,77,178,29,88,63,255,217,53,0,0,0,67,0,58,0,92,0,85,0,115,0,101,0,114,0,115,0,92,0,77,0,65,0,75,0,85,0,77,0,66,0,73,0,92,0,65,0,112,0,112,0,68,0,97,0,116,0,97,0,92,0,76,0,111,0,99,0,97,0,108,0,92,0,84,0,101,0,109,0,112,0,92,0,98,0,98,0,97,0,97,0,108,0,101,0,32,0,107,0,105,0,122,0,105,0,116,0,111,0,46,0,106,0,112,0,103,0,17,0,0,0,98,0,98,0,97,0,97,0,108,0,101,0,32,0,107,0,105,0,122,0,105,0,116,0,111,0,46,0,106,0,112,0,103,0,51,0,0,0,68,0,58,0,92,0,80,0,82,0,79,0,74,0,69,0,67,0,84,0,83,0,32,0,65,0,78,0,68,0,82,0,79,0,73,0,68,0,92,0,83,0,81,0,76,0,92,0,83,0,81,0,76,0,92,0,70,0,105,0,108,0,101,0,115,0,92,0,98,0,98,0,97,0,97,0,108,0,101,0,32,0,107,0,105,0,122,0,105,0,116,0,111,0,46,0,106,0,112,0,103,0,1,5,0,0,0,0,0,0,164,173,5,254],"autofield":1},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ACCOUNTS","Mid":22,"Ends":41,"Grade":"C4","Term":"TERM1","Years":"2019","Total":63,"pHOTOS":null,"autofield":2},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ACCOUNTS","Mid":22,"Ends":41,"Grade":"C4","Term":"TERM1","Years":"2019","Total":63,"pHOTOS":null,"autofield":3},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENGLISH","Mid":32,"Ends":42,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":4},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENGLISH","Mid":32,"Ends":42,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":5},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENGLISH","Mid":32,"Ends":42,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":6},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"MATHEMATICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":93,"pHOTOS":null,"autofield":7},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"MATHEMATICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":93,"pHOTOS":null,"autofield":8},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"MATHEMATICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":93,"pHOTOS":null,"autofield":9},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"BIOLOGY","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":10},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"BIOLOGY","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":11},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"BIOLOGY","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":12},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"COMPUTER","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":14},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"COMPUTER","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":13},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"COMPUTER","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":15},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CHEMISTRY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":16},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CHEMISTRY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":17},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CHEMISTRY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":18},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENTREPRENUERSHIP","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":54,"pHOTOS":null,"autofield":19},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENTREPRENUERSHIP","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":54,"pHOTOS":null,"autofield":20},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENTREPRENUERSHIP","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":54,"pHOTOS":null,"autofield":21},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"HISTORY","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":53,"pHOTOS":null,"autofield":22},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"HISTORY","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":53,"pHOTOS":null,"autofield":23},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"HISTORY","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":53,"pHOTOS":null,"autofield":24},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ADD-MATHS","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":73,"pHOTOS":null,"autofield":26},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ADD-MATHS","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":73,"pHOTOS":null,"autofield":25},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ADD-MATHS","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":73,"pHOTOS":null,"autofield":27},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"FINE-ART","Mid":null,"Ends":null,"Grade":"C3","Term":"TERM1","Years":"2019","Total":68,"pHOTOS":null,"autofield":28},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"FINE-ART","Mid":null,"Ends":null,"Grade":"C3","Term":"TERM1","Years":"2019","Total":68,"pHOTOS":null,"autofield":29},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"FINE-ART","Mid":null,"Ends":null,"Grade":"C3","Term":"TERM1","Years":"2019","Total":68,"pHOTOS":null,"autofield":30},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CRE","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":80,"pHOTOS":null,"autofield":31},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CRE","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":80,"pHOTOS":null,"autofield":32},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CRE","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":80,"pHOTOS":null,"autofield":33},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"PHYSICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":34},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"PHYSICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":35},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"PHYSICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":36},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":934,"pHOTOS":null,"autofield":37},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":934,"pHOTOS":null,"autofield":38},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":934,"pHOTOS":null,"autofield":39},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":49,"pHOTOS":null,"autofield":40},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":41},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":49,"pHOTOS":null,"autofield":42},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":49,"pHOTOS":null,"autofield":43},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":85,"pHOTOS":null,"autofield":44},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"GEOGRAPHY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":45},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":46},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":47},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":85,"pHOTOS":null,"autofield":48},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":85,"pHOTOS":null,"autofield":49},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"GEOGRAPHY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":50},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"GEOGRAPHY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":51},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":52},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":53},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":54},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":55},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":56},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":57},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":58},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":59},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":60},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":5,"pHOTOS":null,"autofield":61},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":62},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":63},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":67,"pHOTOS":null,"autofield":64},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":65},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":66},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":67},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":68},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":5,"pHOTOS":null,"autofield":69},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":5,"pHOTOS":null,"autofield":70},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":67,"pHOTOS":null,"autofield":71},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":67,"pHOTOS":null,"autofield":72}]
 

walterf25

Expert
Licensed User
Longtime User
Please help i have this json extract which i would like to convert to bmp and then insert into my app
i wanted to use this code to assign the converted image to the input stream so that it is converted
B4X:
Sub InsertBlob
    'convert the image file to a bytes array
    Dim InputStream1 As InputStream
    InputStream1 = File.OpenInput(File.DirAssets, "BBAALE KIZITO.JPG")
    Dim OutputStream1 As OutputStream
    OutputStream1.InitializeToBytesArray(1000)
    File.Copy2(InputStream1, OutputStream1)
    Dim Buffer() As Byte
    Buffer = OutputStream1.ToBytesArray
   
    'write the image to the database
    SQL1.ExecNonQuery2("INSERT INTO table2 VALUES('smiley', ?)", Array As Object(Buffer))
End Sub
B4X:
[{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ACCOUNTS","Mid":22,"Ends":41,"Grade":"C4","Term":"TERM1","Years":"2019","Total":63,"pHOTOS":[21,28,50,0,2,0,0,0,22,0,8,0,20,0,42,0,255,255,255,255,80,97,99,107,97,103,101,114,32,83,104,101,108,108,32,79,98,106,101,99,116,0,80,97,99,107,97,103,101,0,1,5,0,0,2,0,0,0,8,0,0,0,80,97,99,107,97,103,101,0,0,0,0,0,0,0,0,0,26,168,0,0,2,0,98,98,97,97,108,101,32,107,105,122,105,116,111,46,106,112,103,0,68,58,92,80,82,79,74,69,67,84,83,32,65,78,68,82,79,73,68,92,83,81,76,92,83,81,76,92,70,105,108,101,115,92,98,98,97,97,108,101,32,107,105,122,105,116,111,46,106,112,103,0,0,0,3,0,54,0,0,0,67,58,92,85,115,101,114,115,92,77,65,75,85,77,66,73,92,65,112,112,68,97,116,97,92,76,111,99,97,108,92,84,101,109,112,92,98,98,97,97,108,101,32,107,105,122,105,116,111,46,106,112,103,0,146,166,0,0,255,216,255,225,21,56,69,120,105,102,0,0,73,73,42,0,8,0,0,0,16,0,0,1,3,0,1,0,0,0,160,15,0,0,1,1,3,0,1,0,0,0,184,11,0,0,2,1,3,0,3,0,0,0,206,0,0,0,6,1,3,0,1,0,0,0,2,0,0,0,14,1,2,0,32,0,0,0,212,0,0,0,15,1,2,0,6,0,0,0,244,0,0,0,16,1,2,0,25,0,0,0,250,0,0,0,18,1,3,0,1,0,0,0,1,0,0,0,21,1,3,0,1,0,0,0,3,0,0,0,26,1,5,0,1,0,0,0,19,1,0,0,27,1,5,0,1,0,0,0,27,1,0,0,40,1,3,0,1,0,0,0,2,0,0,0,49,1,2,0,28,0,0,0,35,1,0,0,50,1,2,0,20,0,0,0,63,1,0,0,19,2,3,0,1,0,0,0,2,0,0,0,105,135,4,0,1,0,0,0,84,1,0,0,164,4,0,0,8,0,8,0,8,0,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,0,67,97,110,111,110,0,67,97,110,111,110,32,80,111,119,101,114,83,104,111,116,32,65,51,49,48,48,32,73,83,0,192,198,45,0,16,39,0,0,192,198,45,0,16,39,0,0,65,100,111,98,101,32,80,104,111,116,111,115,104,111,112,32,67,83,53,32,87,105,110,100,111,119,115,0,50,48,49,53,58,49,49,58,50,52,32,49,53,58,51,53,58,51,52,0,0,32,0,154,130,5,0,1,0,0,0,218,2,0,0,157,130,5,0,1,0,0,0,226,2,0,0,39,136,3,0,1,0,0,0,200,0,0,0,0,144,7,0,4,0,0,0,48,50,50,49,3,144,2,0,20,0,0,0,234,2,0,0,4,144,2,0,20,0,0,0,254,2,0,0,1,145,7,0,4,0,0,0,1,2,3,0,2,145,5,0,1,0,0,0,18,3,0,0,1,146,10,0,1,0,0,0,26,3,0,0,2,146,5,0,1,0,0,0,34,3,0,0,4,146,10,0,1,0,0,0,42,3,0,0,5,146,5,0,1,0,0,0,50,3,0,0,6,146,5,0,1,0,0,0,58,3,0,0,7,146,3,0,1,0,0,0,5,0,0,0,9,146,3,0,1,0,0,0,16,0,0,0,10,146,5,0,1,0,0,0,66,3,0,0,134,146,7,0,8,1,0,0,74,3,0,0,0,160,7,0,4,0,0,0,48,49,48,48,1,160,3,0,1,0,0,0,1,0,0,0,2,160,4,0,1,0,0,0,95,1,0,0,3,160,4,0,1,0,0,0,173,1,0,0,5,160,4,0,1,0,0,0,108,4,0,0,14,162,5,0,1,0,0,0,82,4,0,0,15,162,5,0,1,0,0,0,90,4,0,0,16,210,30,137,245,253,63,179,78,98,188,169,183,169,203,253,150,45,146,226,225,23,201,52,197,173,216,170,31,80,250,183,212,103,250,205,61,14,7,212,173,58,83,223,191,134,3,93,89,70,239,102,15,107,195,130,214,181,239,203,175,249,211,48,37,229,244,187,248,95,8,85,219,126,63,103,223,36,60,144,89,102,137,245,47,168,175,213,77,69,127,122,88,0,252,251,242,2,187,230,100,42,182,116,186,142,46,47,82,63,36,210,236,85,216,171,177,87,98,174,197,93,138,187,21,118,42,149,249,153,188,196,52,137,199,151,210,7,212,138,176,137,174,28,168,93,186,168,10,193,223,249,21,218,52,229,246,219,39,143,134,253,76,241,240,223,171,147,228,89,62,177,234,77,207,152,127,85,125,90,212,183,218,239,95,127,181,149,102,226,189,249,61,118,15,160,87,210,218,253,175,249,232,220,105,242,218,153,9,116,110,143,55,47,65,211,236,167,95,14,88,3,97,181,237,94,45,95,179,201,235,255,0,4,181,201,37,167,254,241,233,246,120,201,211,232,174,20,239,75,7,236,242,251,85,126,63,205,77,178,29,88,63,255,217,53,0,0,0,67,0,58,0,92,0,85,0,115,0,101,0,114,0,115,0,92,0,77,0,65,0,75,0,85,0,77,0,66,0,73,0,92,0,65,0,112,0,112,0,68,0,97,0,116,0,97,0,92,0,76,0,111,0,99,0,97,0,108,0,92,0,84,0,101,0,109,0,112,0,92,0,98,0,98,0,97,0,97,0,108,0,101,0,32,0,107,0,105,0,122,0,105,0,116,0,111,0,46,0,106,0,112,0,103,0,17,0,0,0,98,0,98,0,97,0,97,0,108,0,101,0,32,0,107,0,105,0,122,0,105,0,116,0,111,0,46,0,106,0,112,0,103,0,51,0,0,0,68,0,58,0,92,0,80,0,82,0,79,0,74,0,69,0,67,0,84,0,83,0,32,0,65,0,78,0,68,0,82,0,79,0,73,0,68,0,92,0,83,0,81,0,76,0,92,0,83,0,81,0,76,0,92,0,70,0,105,0,108,0,101,0,115,0,92,0,98,0,98,0,97,0,97,0,108,0,101,0,32,0,107,0,105,0,122,0,105,0,116,0,111,0,46,0,106,0,112,0,103,0,1,5,0,0,0,0,0,0,164,173,5,254],"autofield":1},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ACCOUNTS","Mid":22,"Ends":41,"Grade":"C4","Term":"TERM1","Years":"2019","Total":63,"pHOTOS":null,"autofield":2},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ACCOUNTS","Mid":22,"Ends":41,"Grade":"C4","Term":"TERM1","Years":"2019","Total":63,"pHOTOS":null,"autofield":3},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENGLISH","Mid":32,"Ends":42,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":4},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENGLISH","Mid":32,"Ends":42,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":5},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENGLISH","Mid":32,"Ends":42,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":6},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"MATHEMATICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":93,"pHOTOS":null,"autofield":7},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"MATHEMATICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":93,"pHOTOS":null,"autofield":8},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"MATHEMATICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":93,"pHOTOS":null,"autofield":9},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"BIOLOGY","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":10},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"BIOLOGY","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":11},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"BIOLOGY","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":74,"pHOTOS":null,"autofield":12},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"COMPUTER","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":14},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"COMPUTER","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":13},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"COMPUTER","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":15},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CHEMISTRY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":16},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CHEMISTRY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":17},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CHEMISTRY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":18},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENTREPRENUERSHIP","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":54,"pHOTOS":null,"autofield":19},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENTREPRENUERSHIP","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":54,"pHOTOS":null,"autofield":20},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ENTREPRENUERSHIP","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":54,"pHOTOS":null,"autofield":21},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"HISTORY","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":53,"pHOTOS":null,"autofield":22},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"HISTORY","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":53,"pHOTOS":null,"autofield":23},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"HISTORY","Mid":null,"Ends":null,"Grade":"C6","Term":"TERM1","Years":"2019","Total":53,"pHOTOS":null,"autofield":24},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ADD-MATHS","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":73,"pHOTOS":null,"autofield":26},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ADD-MATHS","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":73,"pHOTOS":null,"autofield":25},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"ADD-MATHS","Mid":null,"Ends":null,"Grade":"D2","Term":"TERM1","Years":"2019","Total":73,"pHOTOS":null,"autofield":27},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"FINE-ART","Mid":null,"Ends":null,"Grade":"C3","Term":"TERM1","Years":"2019","Total":68,"pHOTOS":null,"autofield":28},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"FINE-ART","Mid":null,"Ends":null,"Grade":"C3","Term":"TERM1","Years":"2019","Total":68,"pHOTOS":null,"autofield":29},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"FINE-ART","Mid":null,"Ends":null,"Grade":"C3","Term":"TERM1","Years":"2019","Total":68,"pHOTOS":null,"autofield":30},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CRE","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":80,"pHOTOS":null,"autofield":31},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CRE","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":80,"pHOTOS":null,"autofield":32},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"CRE","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":80,"pHOTOS":null,"autofield":33},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"PHYSICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":34},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"PHYSICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":35},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"PHYSICS","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":84,"pHOTOS":null,"autofield":36},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":934,"pHOTOS":null,"autofield":37},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":934,"pHOTOS":null,"autofield":38},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":934,"pHOTOS":null,"autofield":39},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":49,"pHOTOS":null,"autofield":40},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":41},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":49,"pHOTOS":null,"autofield":42},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":49,"pHOTOS":null,"autofield":43},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":85,"pHOTOS":null,"autofield":44},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"GEOGRAPHY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":45},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":46},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":47},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":85,"pHOTOS":null,"autofield":48},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":85,"pHOTOS":null,"autofield":49},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"GEOGRAPHY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":50},{"Account":"05-07152","class":"S2","Stream":"W","Names":"MUTESASIRA FRANK","Subject":"GEOGRAPHY","Mid":null,"Ends":null,"Grade":"D1","Term":"TERM1","Years":"2019","Total":79,"pHOTOS":null,"autofield":51},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":52},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":53},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":54},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":55},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":56},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":57},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":58},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":59},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":60},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":5,"pHOTOS":null,"autofield":61},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":62},{"Account":"05-07213","class":"S3","Stream":"G","Names":"OBEL PATRICIA MUTESI","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":1,"pHOTOS":null,"autofield":63},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":67,"pHOTOS":null,"autofield":64},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":65},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"TOTAL MARKS","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":66},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":67},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"AVERAGE","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":0,"pHOTOS":null,"autofield":68},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":5,"pHOTOS":null,"autofield":69},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"POSITIONSTREAM","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":5,"pHOTOS":null,"autofield":70},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":67,"pHOTOS":null,"autofield":71},{"Account":"05-07735","class":"S1","Stream":"B","Names":"NAMAKULA EVLYN","Subject":"OUTOF","Mid":null,"Ends":null,"Grade":null,"Term":"TERM1","Years":"2019","Total":67,"pHOTOS":null,"autofield":72}]
You will need to use the Json Parser library so that you can extract the bytes from the json String and then convert to image. Do a search for Json Library.
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
Dim InputStream1 As InputStream
InputStream1 = File.OpenInput(File.DirAssets, "BBAALE KIZITO.JPG")
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000)
File.Copy2(InputStream1, OutputStream1)
Dim Buffer() As Byte
Buffer = OutputStream1.ToBytesArray

there is also
B4X:
File.ReadBytes
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
He still needs to parse the byte array from the JSON string.

this magic site here
http://basic4ppc.com:51042/json/index.html
result in
B4X:
Dim parser As JSONParser
parser.Initialize(<text>)
Dim root As List = parser.NextArray
For Each colroot As Map In root
 Dim Account As String = colroot.Get("Account")
 Dim Years As String = colroot.Get("Years")
 Dim Mid As Int = colroot.Get("Mid")
 Dim autofield As Int = colroot.Get("autofield")
 Dim Grade As String = colroot.Get("Grade")
 Dim Term As String = colroot.Get("Term")
 Dim Subject As String = colroot.Get("Subject")
 Dim Names As String = colroot.Get("Names")
 Dim Total As Int = colroot.Get("Total")
 Dim Ends As Int = colroot.Get("Ends")
 Dim Stream As String = colroot.Get("Stream")
 Dim pHOTOS As List = colroot.Get("pHOTOS")
 For Each colpHOTOS As Int In pHOTOS
 Next
 Dim class As String = colroot.Get("class")
Next
its not a byte array but something to start with
 
Upvote 0

emexes

Expert
Licensed User
Hey Makumbi,

I think your image has been truncrated when it was written to the database or extracted as JSON. I can see the JPEG SOI and EOI markers and I am getting that it is a photo taken on a Canon Powershot A3100 IS, probably in 2015 (although don't go placing any bets on that, because camera clocks are often wrong ;-), edited by Photoshop CS5 under Windows, and that the image is 4000 x 3000 pixels large, but: there are only 1393 bytes in the only non-null JSON "pHOTOS" field. JPEG has good compression, it is not *that* good.

There is about 250 bytes of actual JPEG-ish looking image data. I did think that perhaps that was the thumbnail, but there are no thumbnail markers or "JFXX" identifier in the data at all.

Also, the JPEG image from SOI to EOI is 1126 bytes in the middle of the 1393 bytes of "pHOTOS" data, and it looks like the JPEG image has been wrapped by/into something called "Packager Shell Object" which has references to "D:\PROJECTS ANDROID\SQL\SQL\Files\bbaale kizito.jpg" and "C:\Users\MAKUMBI\AppData\Local\Temp\bbaale kizito.jpg" (just in case you think I'm making this info up... ;-)

Anyway, that's all I got. My next tack would be to go back to the dude (or dudette) who gave you this data sample, and get them to show you the photo on the system that created it. Good luck with that...

:)
 
Upvote 0

emexes

Expert
Licensed User
This is the non-null JSON "pHOTOS" data in hex and ASCII, in case you've got some ideas about interpreting it that I might have missed:

B4X:
000: 151C 3200 0200 0000 1600 0800 1400 2A00  ..2...........*.
010: FFFF FFFF 5061 636B 6167 6572 2053 6865  ÿÿÿÿPackager She
020: 6C6C 204F 626A 6563 7400 5061 636B 6167  ll Object.Packag
030: 6500 0105 0000 0200 0000 0800 0000 5061  e.............Pa
040: 636B 6167 6500 0000 0000 0000 0000 1AA8  ckage..........¨
050: 0000 0200 6262 6161 6C65 206B 697A 6974  ....bbaale kizit
060: 6F2E 6A70 6700 443A 5C50 524F 4A45 4354  o.jpg.D:\PROJECT
070: 5320 414E 4452 4F49 445C 5351 4C5C 5351  S ANDROID\SQL\SQ
080: 4C5C 4669 6C65 735C 6262 6161 6C65 206B  L\Files\bbaale k
090: 697A 6974 6F2E 6A70 6700 0000 0300 3600  izito.jpg.....6.
0A0: 0000 433A 5C55 7365 7273 5C4D 414B 554D  ..C:\Users\MAKUM
0B0: 4249 5C41 7070 4461 7461 5C4C 6F63 616C  BI\AppData\Local
0C0: 5C54 656D 705C 6262 6161 6C65 206B 697A  \Temp\bbaale kiz
0D0: 6974 6F2E 6A70 6700 92A6 0000 FFD8 FFE1  ito.jpg.’¦..ÿØÿá
0E0: 1538 4578 6966 0000 4949 2A00 0800 0000  .8Exif..II*.....
0F0: 1000 0001 0300 0100 0000 A00F 0000 0101  .......... .....
100: 0300 0100 0000 B80B 0000 0201 0300 0300  ......¸.........
110: 0000 CE00 0000 0601 0300 0100 0000 0200  ..Î.............
120: 0000 0E01 0200 2000 0000 D400 0000 0F01  ...... ...Ô.....
130: 0200 0600 0000 F400 0000 1001 0200 1900  ......ô.........
140: 0000 FA00 0000 1201 0300 0100 0000 0100  ..ú.............
150: 0000 1501 0300 0100 0000 0300 0000 1A01  ................
160: 0500 0100 0000 1301 0000 1B01 0500 0100  ................
170: 0000 1B01 0000 2801 0300 0100 0000 0200  ......(.........
180: 0000 3101 0200 1C00 0000 2301 0000 3201  ..1.......#...2.
190: 0200 1400 0000 3F01 0000 1302 0300 0100  ......?.........
1A0: 0000 0200 0000 6987 0400 0100 0000 5401  ......i‡......T.
1B0: 0000 A404 0000 0800 0800 0800 2020 2020  ..¤.........   
1C0: 2020 2020 2020 2020 2020 2020 2020 2020                 
1D0: 2020 2020 2020 2020 2020 2000 4361 6E6F             .Cano
1E0: 6E00 4361 6E6F 6E20 506F 7765 7253 686F  n.Canon PowerSho
1F0: 7420 4133 3130 3020 4953 00C0 C62D 0010  t A3100 IS.ÀÆ-..
200: 2700 00C0 C62D 0010 2700 0041 646F 6265  '..ÀÆ-..'..Adobe
210: 2050 686F 746F 7368 6F70 2043 5335 2057   Photoshop CS5 W
220: 696E 646F 7773 0032 3031 353A 3131 3A32  indows.2015:11:2
230: 3420 3135 3A33 353A 3334 0000 2000 9A82  4 15:35:34.. .š‚
240: 0500 0100 0000 DA02 0000 9D82 0500 0100  ......Ú...‚....
250: 0000 E202 0000 2788 0300 0100 0000 C800  ..â...'ˆ......È.
260: 0000 0090 0700 0400 0000 3032 3231 0390  .........0221.
270: 0200 1400 0000 EA02 0000 0490 0200 1400  ......ê........
280: 0000 FE02 0000 0191 0700 0400 0000 0102  ..þ....‘........
290: 0300 0291 0500 0100 0000 1203 0000 0192  ...‘...........’
2A0: 0A00 0100 0000 1A03 0000 0292 0500 0100  ...........’....
2B0: 0000 2203 0000 0492 0A00 0100 0000 2A03  .."....’......*.
2C0: 0000 0592 0500 0100 0000 3203 0000 0692  ...’......2....’
2D0: 0500 0100 0000 3A03 0000 0792 0300 0100  ......:....’....
2E0: 0000 0500 0000 0992 0300 0100 0000 1000  .......’........
2F0: 0000 0A92 0500 0100 0000 4203 0000 8692  ...’......B...†’
300: 0700 0801 0000 4A03 0000 00A0 0700 0400  ......J.... ....
310: 0000 3031 3030 01A0 0300 0100 0000 0100  ..0100. ........
320: 0000 02A0 0400 0100 0000 5F01 0000 03A0  ... ......_....
330: 0400 0100 0000 AD01 0000 05A0 0400 0100  .......... ....
340: 0000 6C04 0000 0EA2 0500 0100 0000 5204  ..l....¢......R.
350: 0000 0FA2 0500 0100 0000 5A04 0000 10D2  ...¢......Z....Ò
360: 1E89 F5FD 3FB3 4E62 BCA9 B7A9 CBFD 962D  .‰õý?³Nb¼©·©Ëý–-
370: 92E2 E117 C934 C5AD D8AA 1F50 FAB7 D467  ’âá.É4Åت.Pú·Ôg
380: FACD 3D0E 07D4 AD3A 53DF BF86 035D 5946  úÍ=..Ô:Sß¿†.]YF
390: EF66 0F6B C382 D6B5 EFCB AFF9 D330 25E5  ïf.kÂֵï˯ùÓ0%å
3A0: F4BB F85F 0855 DB7E 3F67 DF24 3C90 5966  ô»ø_.UÛ~?gß$<Yf
3B0: 89F5 2FA8 AFD5 4D45 7F7A 5800 FCFB F202  ‰õ/¨¯ÕMEzX.üûò.
3C0: BBE6 642A B674 BA8E 2E2F 523F 24D2 EC55  »æd*¶tºŽ./R?$ÒìU
3D0: D8AB B157 62AE C55D 8ABB 1576 2A95 F999  Ø«±Wb®Å]Š».v*•ù™
3E0: BCC4 3489 C797 D207 D48A B089 AE1C A85D  ¼Ä4‰Ç—Ò.ÔŠ°‰®.¨]
3F0: BAA8 0AC1 DFF9 15DA 34E5 F6DB 278F 86FD  º¨.Áßù.Ú4åöÛ'†ý
400: 4CF1 F0DF AB93 E459 3EB1 EA4D CF98 7F55  Lñðß«“äY>±êMϘU
410: 7D5A D4B7 DAEF 5F7F B595 66E2 BDF9 3D76  }ZÔ·Úï_µ•fâ½ù=v
420: 0FA0 57D2 DAFD AFF9 E8DC 69F2 DA99 0974  . WÒÚý¯ùèÜiòÚ™.t
430: 6E8F 372F 41D3 ECA7 5F0E 5803 61B5 ED5E  n7/AÓì§_.X.aµí^
440: 2D5F B3C9 EBFF 0004 B5C9 25A7 FEF1 E9F6  -_³Éëÿ..µÉ%§þñéö
450: 78C9 D3E8 AE14 EF4B 07EC F2FB 557E 3FCD  xÉÓè®.ïK.ìòûU~?Í
460: 4DB2 1D58 3FFF D935 0000 0043 003A 005C  M².X?ÿÙ5...C.:.\
470: 0055 0073 0065 0072 0073 005C 004D 0041  .U.s.e.r.s.\.M.A
480: 004B 0055 004D 0042 0049 005C 0041 0070  .K.U.M.B.I.\.A.p
490: 0070 0044 0061 0074 0061 005C 004C 006F  .p.D.a.t.a.\.L.o
4A0: 0063 0061 006C 005C 0054 0065 006D 0070  .c.a.l.\.T.e.m.p
4B0: 005C 0062 0062 0061 0061 006C 0065 0020  .\.b.b.a.a.l.e.
4C0: 006B 0069 007A 0069 0074 006F 002E 006A  .k.i.z.i.t.o...j
4D0: 0070 0067 0011 0000 0062 0062 0061 0061  .p.g.....b.b.a.a
4E0: 006C 0065 0020 006B 0069 007A 0069 0074  .l.e. .k.i.z.i.t
4F0: 006F 002E 006A 0070 0067 0033 0000 0044  .o...j.p.g.3...D
500: 003A 005C 0050 0052 004F 004A 0045 0043  .:.\.P.R.O.J.E.C
510: 0054 0053 0020 0041 004E 0044 0052 004F  .T.S. .A.N.D.R.O
520: 0049 0044 005C 0053 0051 004C 005C 0053  .I.D.\.S.Q.L.\.S
530: 0051 004C 005C 0046 0069 006C 0065 0073  .Q.L.\.F.i.l.e.s
540: 005C 0062 0062 0061 0061 006C 0065 0020  .\.b.b.a.a.l.e.
550: 006B 0069 007A 0069 0074 006F 002E 006A  .k.i.z.i.t.o...j
560: 0070 0067 0001 0500 0000 0000 00A4 AD05  .p.g.........¤.
570: FE                                       þ
 
Upvote 0

Makumbi

Well-Known Member
Licensed User
Hey Makumbi,

I think your image has been truncrated when it was written to the database or extracted as JSON. I can see the JPEG SOI and EOI markers and I am getting that it is a photo taken on a Canon Powershot A3100 IS, probably in 2015 (although don't go placing any bets on that, because camera clocks are often wrong ;-), edited by Photoshop CS5 under Windows, and that the image is 4000 x 3000 pixels large, but: there are only 1393 bytes in the only non-null JSON "pHOTOS" field. JPEG has good compression, it is not *that* good.

There is about 250 bytes of actual JPEG-ish looking image data. I did think that perhaps that was the thumbnail, but there are no thumbnail markers or "JFXX" identifier in the data at all.

Also, the JPEG image from SOI to EOI is 1126 bytes in the middle of the 1393 bytes of "pHOTOS" data, and it looks like the JPEG image has been wrapped by/into something called "Packager Shell Object" which has references to "D:\PROJECTS ANDROID\SQL\SQL\Files\bbaale kizito.jpg" and "C:\Users\MAKUMBI\AppData\Local\Temp\bbaale kizito.jpg" (just in case you think I'm making this info up... ;-)

Anyway, that's all I got. My next tack would be to go back to the dude (or dudette) who gave you this data sample, and get them to show you the photo on the system that created it. Good luck with that...

:)
i truncate the image because it was exceeding the required characters for it to be posted on this platform but i think you have the idea of what i wanted to do currently i have the photo saved in my SQLserver database now i was looking for a way of extracting that photo and then send to a table in my app using json as i had showed you above. thanks
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
Wouldn't it be easier to save your images on disk and keep track of them using the location paths in the json?

e.g.
B4X:
[
  {
    "Account": "05-07152",
    "class": "S2",
    "Stream": "W",
    "Names": "MUTESASIRA FRANK",
    "Subject": "ACCOUNTS",
    "Mid": 22,
    "Ends": 41,
    "Grade": "C4",
    "Term": "TERM1",
    "Years": "2019",
    "Total": 63,
    "pHOTOS": [
      "/photopath/mypic1.jpg",
      "/photopath/myimage2.png"
    ],
    "autofield": 1
  }
]
 
Upvote 0

emexes

Expert
Licensed User
i truncate the image

Well, that would have been useful to know ;-) although I guess I should have considered that possibility.

It does beg the question of wtf that JPEG EOI marker is doing in the truncated file if there is no corresponding SOI marker (assuming it's for a thumbnail) but I'm not going to pull on that little mystery thread.

My second reaction was: you're going to have some awfully big "pHOTOS" fields in your database. Presumably the original untruncated JPEG is about 6 MB large, and if each of those bytes is stored as typically 2.6 decimal digits plus a comma, then each photo in your database is going to be over 20 MB. Imagine how long those are going to take to transfer over wireless network connections, or to load up onto your mobile database if you're storing it locally.

You're not going to improve much on JPEG's compression ratio, although you could decrease the quality from the camera's ~99 down to 70-80, and that will reduce your photos down to maybe 1-2 MB. Next, what are the photos being used for on the mobile device? What image resolution do you need on the device? Do you need printable resolution, or is it just to show the photo at eg 300 x 400 on the screen? If you just need the latter, then resize the photos to 300 x 400 and you'll have decreased the number of pixels by 99%. Now we're talking! Perhaps maybe decrease it half as much, to 600 x 800, just in case some future application needs it. I just checked with a typical photo here, and saving it as 800 x 600 at quality 80 gives a 72 kB JPEG file, ie more than 80-times smaller than what you're working with now.

Next, instead of storing the JPEG file as comma-delimited ASCII decimal (= 3.6 bytes per file-byte), consider storing it as 2-digit ASCII hex (= 2 bytes per file-byte). That almost halves your database field size again. At this rate of progress, soon we won't have to store anything ;-)

If you're lucky, your database might compress large fields itself = another 50% reduction.

I'm pretty sure that ByteConverter will convert both ways between an array-of-bytes (your JPEG file) and a string of hex (to store in your database or transfer via JSON). Other replies above to your query have covered those processes, so I won't repeat them here.

I'd wish you good luck, but I think we're close enough to a solution that you'll get there anyway ;-)

Cheers!
 
Last edited:
Upvote 0

emexes

Expert
Licensed User
Wouldn't it be easier to save your images on disk and keep track of them using the location paths in the json?

+1 this (if the database and images are local, eg, you're not using the database over a network as an one-implementation-to-do-it-all data transfer solution)

but the guff about shrinking images to a manageable size appropriate to the use-case still applies
 
Upvote 0

MarkusR

Well-Known Member
Licensed User
Longtime User
seems u have a webservice that gave your ap the data, true? if yes can you edit it by yourself and its ms or java world?
if u have a image in a binary field in database you can send it as byte stream.
in a local sqlite database it fit into a blob field.
i would not use large binary files in json, i would let bytes bytes.
 
Upvote 0
Top