Recent

Author Topic: Image manipulation in Lazarus  (Read 35503 times)

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: Image manipulation in Lazarus
« Reply #30 on: May 11, 2013, 08:36:30 pm »
Is there no Load.../SaveToStream()? You wouldn't need anything related to RawImage in your code then.
Does not work. "Jpeg error". I think Loadfromstream tries to find image header or other image system information
WinXP SP3 Pro Russian 32-bit (5.1.2600)

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: Image manipulation in Lazarus
« Reply #31 on: May 11, 2013, 11:58:49 pm »
I have made working example, which encrypt project.exe to PNG-image. Then PNG-image can be decrypted. No cheching errors... 
But example makes 32-bit image (v_v)
WinXP SP3 Pro Russian 32-bit (5.1.2600)

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: Image manipulation in Lazarus
« Reply #32 on: May 12, 2013, 09:27:18 am »
In this wiki page http://wiki.freepascal.org/Fast_direct_pixel_access is said that "TLazIntfImage is a memory image. I can store transparency and 16-bit values for each channel." So it can keep 64-bit per pixel raw data. But where can I find routines for correctly saving that images?
WinXP SP3 Pro Russian 32-bit (5.1.2600)

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Image manipulation in Lazarus
« Reply #33 on: May 12, 2013, 10:18:18 am »
You should first check if you can simply save 64-bit JPG normally, and afterwards include the encryption. I'm still in opinion that the streams should do the trick, it's just matter of doing everything in right order. Resetting position to 0 in right place etc.

anna

  • Sr. Member
  • ****
  • Posts: 426
Re: Image manipulation in Lazarus
« Reply #34 on: May 12, 2013, 05:40:44 pm »
You should first check if you can simply save 64-bit JPG normally, and afterwards include the encryption. I'm still in opinion that the streams should do the trick, it's just matter of doing everything in right order. Resetting position to 0 in right place etc.
I don't know how to do it . Can you give a routine, please?
WinXP SP3 Pro Russian 32-bit (5.1.2600)

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Image manipulation in Lazarus
« Reply #35 on: May 12, 2013, 07:11:30 pm »
Starting with something simple, just SaveToFile() first. How do you build a 64bit image in the first place? I don't know how to make it 64-bit. Does it draw properly on your form, using standard Canvas.Draw command? Add that to roughly this kind code:
Code: [Select]
var pic: TPicture;
begin
  // --- Build the image ---
  pic:=TPicture.Create;
  //pic.Bitmap.PixelFormat:=pfCustom; // ???
  pic.Bitmap.SetSize(256, 256);
  pic.Bitmap.Canvas.TextOut(10, 10, 'Test');

  // --- Save it ---
  pic.SaveToFile('c:\test.jpg');
  pic.Free;
If that works, you can then look into how to encrypt the stream. SaveToFile is using FileStream internally, so it's good enough for testing.

 

TinyPortal © 2005-2018