首页 > 代码库 > Datasnap Image
Datasnap Image
delphi用,不能与java、c#互相识别。
procedure TServerMethods.UpdateDoc(ItemID : integer; doc : TStream);
delphi用,不能与java、c#互相识别。
procedure TServerMethods.UpLoadFile(ADoc: TJSONArray);
jsonArray := TDBXJSONTools.StreamToJSON(aStream, 0, aStream.Size);
bstream := TDBXJSONTools.JSONToStream(jsonArray);
procedure TForm2.Button4Click(Sender: TObject); var jpg, jpg2: TJPEGImage; aStream: TMemoryStream; bstream: TStream; jsonArray: TJSONArray; begin jpg := TJPEGImage.Create; jpg.LoadFromFile(‘e:\test.jpg‘); Image1.Picture.Assign(jpg); aStream := TMemoryStream.Create; jpg.SaveToStream(aStream); aStream.Position := 0; jsonArray := TDBXJSONTools.StreamToJSON(aStream, 0, aStream.Size); RichEdit1.Text := jsonArray.Value; RichEdit1.Text := jsonArray.ToString; RichEdit1.Text := jsonArray.ToJSON; // 纯数字 不能跨语言 java c#互相识别 // jsonArray:= TJSONObject.ParseJSONValue(RichEdit1.Text); bstream := TDBXJSONTools.JSONToStream(jsonArray); jpg2 := TJPEGImage.Create; bstream.Position := 0; jpg2.LoadFromStream(bstream); Image2.Picture.Assign(jpg2); jpg.Free; end;
http://www.cnblogs.com/codingnote/archive/2012/04/09/2438673.html
http://stackoverflow.com/questions/16550915/how-to-convert-a-json-string-to-an-image
http://blog.csdn.net/shandiantianying/article/details/9022121
string,base64
class function CreateTDataSetFromJSON(value: TJSONObject): TDataset;
class function TDataSetToJSONObject(value: TDataset): TJSONObject;
跨语言C#、java
Delphi读取b64字符串
procedure TForm2.Button3Click(Sender: TObject); var strStream: TStringStream; b64: TBase64Encoding; aStream: TMemoryStream; jpg2: TJPEGImage; begin strStream := TStringStream.Create; strStream.LoadFromFile(‘e:\b64CSharp.txt‘); strStream.Position := 0; b64 := TBase64Encoding.Create; aStream := TMemoryStream.Create; b64.Decode(strStream, aStream); aStream.Position := 0; jpg2 := TJPEGImage.Create; jpg2.LoadFromStream(aStream); Image2.Picture.Assign(jpg2); strStream.Free; b64.Free; aStream.Free; jpg2.Free; end;
c#图片base64编码
private void button1_Click(object sender, EventArgs e) { System.IO.MemoryStream ms = new System.IO.MemoryStream(); System.Drawing.Bitmap bp = new Bitmap(@"e:\test.jpg"); bp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] b = ms.GetBuffer(); this.richTextBox1.Text = Convert.ToBase64String(b); }
C#图片baes64解码
byte[] bt = Convert.FromBase64String(base64string); System.IO.MemoryStream stream = new System.IO.MemoryStream(bt); Bitmap bitmap = new Bitmap(stream); pictureBox1.Image = bitmap;
Datasnap Image
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。