How to display raw image data with html and javascript? -
i have ajax application php side sends uncoded raw image data, coming camera, client javascript side.
i display image via html , javascript using img
or canvas
tags.
image data 32*32 unsigned char.
i do, whatever takes reach goal (encoding or everythig else), want @ client side beacause cannot handle other operation @ server side.
i tried encode raw data jpeg or png data without success.
i post example doesn't work:
var encoder = new jpegencoder(9); var jpgfile = encoder.encode(rawimage, 9); document.getelementbyid("image").src = jpgfile;
jpgfile
like
data:image/jpeg;base64,/9j/4aaqskzjrgabaqaaaqabaad/2wceafk9q05doflose5kxllphd6qhxp6hf/czahe//////////////////////////////////////////////////8bxmrkhxwf/5cq///////////////////////////////////////////////////////////////////////////aabeiaaaaaambeqaceqedeqh/xagiaaabbqebaqebaqaaaaaaaaaaaqidbaugbwgjcgsqaaibawmcbamfbqqeaaabfqecawaeequsitfbbhnryqcicrqygzghccncscevuthwjdnicoijchyxgbkajsynkckqndu2nzg5okneruzhselku1rvvldywvpjzgvmz2hpann0dxz3ehl6g4sfhoeiiyqsk5svlpeymzqio6slpqeoqaqys7s1tre4ubrcw8tfxsfiycrs09tv1tfy2drh4upk5ebn6onq8flz9px29/j5+geaawebaqebaqebaqaaaaaaaaecawqfbgcicqoleqacaqiebamebwuebaabancaaqideqqfitegekfrb2fxeyiygqguqpghscejizns8bvictekfiq04sxxfxgzgiynkckqnty3odk6q0rfrkdisuptvfvwv1hzwmnkzwznaglqc3r1dnd4exqcg4sfhoeiiyqsk5svlpeymzqio6slpqeoqaqys7s1tre4ubrcw8tfxsfiycrs09tv1tfy2dri4+tl5ufo6ery8/t19vf4+fr/2gamaweaahedeqa/ap8a/9k=
i got jpegencoder googling on internet.
tried =)
all have make sure string base64 encoded , exact same thing have written:
document.getelementbyid("image").src = jpgfile;
Comments
Post a Comment