H henhei Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #1 如何在Delphi中新建一个只有一两个字节的jpeg文件? 用FileCreate吗?可是如何向里面写一两个字节呢? 能否给出源码?
D delphi Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #2 2个字节的jpeg文件好像不可能的吧,存本身的信息都不够。
H henhei Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #3 只要不是太大就可以。但不是用loadfromfile 从文件中导入的,而是由delphi写入的。 how can I do it?
Q qsilence Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #4 连JPEG文件头都不够,更别说内容了,不如建个空文件,扩展名是JPG,随便写两个字节算了
H henhei Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #5 没错! 我也只是建一个空文件,随便写几个字节,可是怎么写???
K kingdeezj Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #8 procedure TForm1.Button1Click(Sender: TObject); var tfile:TFileStream; begin tfile:=TFileStream.Create('c:/1.jpg',fmcreate);//零字节 tfile.free; end;
procedure TForm1.Button1Click(Sender: TObject); var tfile:TFileStream; begin tfile:=TFileStream.Create('c:/1.jpg',fmcreate);//零字节 tfile.free; end;
H henhei Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #9 kingdeezj,怎样在创建jpg文件时写几个字节进去。。??
K kingdeezj Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #10 //要字节也简单. procedure TForm1.Button1Click(Sender: TObject); var MyStream: TMemoryStream; MyTxt: String; begin MyTxt:='aa'; MyStream:=TMemoryStream.Create; MyStream.write(MyTxt[1],length(mytxt)); MyStream.SaveToFile('c:/11.jpg');MyStream.Free; end;
//要字节也简单. procedure TForm1.Button1Click(Sender: TObject); var MyStream: TMemoryStream; MyTxt: String; begin MyTxt:='aa'; MyStream:=TMemoryStream.Create; MyStream.write(MyTxt[1],length(mytxt)); MyStream.SaveToFile('c:/11.jpg');MyStream.Free; end;
H henhei Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #11 不行呀,兄弟,图象显示的时候出错。。 可以把下面的 0x424D46000000000000004200000028000000010000000100000001001000030000000400000000000000000000000000000000000000007C0000E00300001F000000F75E0000 东东写入文件,变为jpg吗??
不行呀,兄弟,图象显示的时候出错。。 可以把下面的 0x424D46000000000000004200000028000000010000000100000001001000030000000400000000000000000000000000000000000000007C0000E00300001F000000F75E0000 东东写入文件,变为jpg吗??
K kingdeezj Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #13 你的上述数据不是有效的JPG图像数据吧?怎么得到的?
P Pipi. Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-27 #14 const a:array[0..xxx(数量-1)] of byte=($42,$4D,$46,$00,.......一直写下去); var f:integer; begin f:=_lcreat('c:/see.jpg',0); _lwrite(f,PChar(@a),sizeof(a)); _lclose(f); end;
const a:array[0..xxx(数量-1)] of byte=($42,$4D,$46,$00,.......一直写下去); var f:integer; begin f:=_lcreat('c:/see.jpg',0); _lwrite(f,PChar(@a),sizeof(a)); _lclose(f); end;
D delphi Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-28 #15 我用photoshop存了一个1*1的jpeg文件,居然有1738个字节。呵呵。
L l_x_yuan Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-28 #16 生成只有0字节的图像 var ss:integer; begin ss:=createfile(pchar('1.jpg'),GENERIC_WRITE,0,nil,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0); fileclose(ss); end;
生成只有0字节的图像 var ss:integer; begin ss:=createfile(pchar('1.jpg'),GENERIC_WRITE,0,nil,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0); fileclose(ss); end;
H hguhgu Unregistered / Unconfirmed GUEST, unregistred user! 2002-03-28 #17 只有一个点的JPG图像,大小为634字节 procedure TForm1.Button1Click(Sender: TObject); var bmp:Tbitmap; Jpeg:TJpegImage; begin bmp:=TBitmap.Create; bmp.Width:=1; bmp.Height:=1; bmp.Canvas.Pixels[0,0]:=clRed; canvas.draw(0,0,bmp); Jpeg:=TJpegImage.Create; Jpeg.Assign(bmp); Jpeg.SaveToFile('D:/test.jpg'); Bmp.destroy; Jpeg.Destroy; end;
只有一个点的JPG图像,大小为634字节 procedure TForm1.Button1Click(Sender: TObject); var bmp:Tbitmap; Jpeg:TJpegImage; begin bmp:=TBitmap.Create; bmp.Width:=1; bmp.Height:=1; bmp.Canvas.Pixels[0,0]:=clRed; canvas.draw(0,0,bmp); Jpeg:=TJpegImage.Create; Jpeg.Assign(bmp); Jpeg.SaveToFile('D:/test.jpg'); Bmp.destroy; Jpeg.Destroy; end;