ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 WriteHiddenData

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Stegano Posted - Feb 22 2013 : 02:03:54
I have a problem with the WriteHidenData and ReadHidenData routines. It's not possible to read out hidden data again, after the image is saved to file and loaded again.


FMaxInfoSize := ImageEnView1.Proc.GetHiddenDataSpace;
//Be sure not to work at the limit
FMaxInfoSize := ceil(FMaxInfoSize * 0.9);
//adapt memo that will contain the text
mmoTextMessage.MaxLength := FMaxInfoSize;

//hide the contents of the memo in the image
procedure TForm10.Button2Click(Sender: TObject);
var
ss: TMemoryStream;
begin
ss := TMemoryStream.Create;
try
mmoTextMessage.Lines.SaveToStream(ss);
ss.Position := 0;
ImageEnView1.Proc.WriteHiddenData(ss.memory, ss.size);
finally
freeandnil(ss);
end;
end;
//Read the hidden text
procedure TForm10.Button3Click(Sender: TObject);
var
ss: TMemoryStream;
begin
Memo1.Clear;
ss := TMemoryStream.Create;
try
ss.Size := ImageEnView1.Proc.ReadHiddenData(nil, 0);
if ss.Size > 0 then
begin
ImageEnView1.Proc.ReadHiddenData(ss.memory, ss.Size);
Memo1.Lines.LoadFromStream(ss);
end;
finally
freeandnil(ss);
end;
end;

Everything works fine UNTIL I SAVE the file and LOAD it again.
I'm aware of the file formats that support hidden text (bmp was used). Here is the routine, that saves the image with the hidden text

procedure TForm10.Button4Click(Sender: TObject);
begin
SaveImageEnDialog1.InitialDir := ExtractFileDir ( ImageEnView1.IO.Params.FileName );
SaveImageEnDialog1.FileName := ExtractFilename ( ImageEnView1.IO.Params.FileName );
if SaveImageEnDialog1.Execute then
begin
ImageEnView1.IO.SaveToFile(SaveImageEnDialog1.FileName);
end;
end;

To load the file
ImageEnView1.IO.LoadFromFile
is used.
--------------------------
It is no problem to hide and unhide a few characters or words, but storing more data does not work.

Is this a bug or what is the problem?
---------------------------
While waiting for your response, I realized, that the same/comparable error occurs within your encryption demo programm. Everything works fine until you save and reopen the image. After reopening, it is not possible to decrypt the image again!

1   L A T E S T    R E P L I E S    (Newest First)
fab Posted - Feb 27 2013 : 02:14:13
Please post a complete example that I can test.