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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Layer Rotation and "export" as image
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

markus42

Germany
16 Posts

Posted - Jan 07 2013 :  07:43:52  Show Profile  Reply
Hello,

i am using TimageENView with some layers (i need layers because some pictures have to displayed about each other during imageprocessing).
The layers can rotated by mouse. After finished all steps in my application i have to "export" the images in the layers to single files (as jpeg) and it's important to export the rotation too.

I hope somebody can helping me.

Kind Regards

Markus42

w2m

USA
1990 Posts

Posted - Jan 07 2013 :  12:04:24  Show Profile  Reply
The following code was added to the layers example. I tested it and the rotated layers are saved correctly:

Update

procedure Tfmain.Export1Click(Sender: TObject);
var
  i: integer;
  iImageEnIO: TImageEnIO;
  iFolder: string;
  iFilename: string;
begin
  Screen.Cursor := crHourGlass;
  try
    iFolder := 'c:\temp\';
    iImageEnIO := TImageEnIO.Create(nil);
    try
      for i := 0 to ImageEnView1.LayersCount - 1 do
      begin
        // Update
        ImageEnView1.LayersFixRotations(i);
        ImageEnView1.LayersFixSizes(i);
        ImageEnView1.LayersFixBorders(i);
        iImageEnIO.AttachedIEBitmap := ImageEnView1.Layers[i].Bitmap;
        iFilename := iFolder + 'Export' + IntToStr(i) + '.jpg';
        iImageEnIO.SaveToFileJpeg(iFilename);
      end;
    finally
      iImageEnIO.Free;
    end;
  finally
    Screen.Cursor := crDefault;
  end;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

markus42

Germany
16 Posts

Posted - Jan 08 2013 :  02:44:25  Show Profile  Reply
Hello Mr. Miller,

thank you alot for your answer. But i am have a problem with this.
The "export" creates an jpeg-file, but without the rotation.
Perhaps i have to set an "special setting"?

I'm hoping you can spent some time to helping me.

Kind regards

Markus
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 08 2013 :  05:53:13  Show Profile  Reply
The code saves the images with rotation here. How many degrees did you rotate? I rotated 90 degrees. I did not test other degrees.

William Miller
Go to Top of Page

markus42

Germany
16 Posts

Posted - Jan 08 2013 :  07:29:14  Show Profile  Reply
I am very sorry, but i try it now in the layers demo with the same result. Rotation not "exported". I rotate 90° and some other values.
IMAGEn version is 4.1.4.

Kind Regards

Markus
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 08 2013 :  08:20:08  Show Profile  Reply
I am using 4.1.4 as well. I just tested it again. I added 3 layers and rotated layer 1 and 2 and exported. All of the images were rotated correctly. I'll see if I can send you my demo and you can try that.

What layers did you rotate?

William Miller
Go to Top of Page

markus42

Germany
16 Posts

Posted - Jan 08 2013 :  08:39:28  Show Profile  Reply
It will be great if you can send me your demo. By the way, i am using Rad-Studio 2010 but i don't think this is the problem.

Kind Regards
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 08 2013 :  08:47:33  Show Profile  Reply
Send your email to w2m@frontiernet.net.

William Miller
Go to Top of Page

markus42

Germany
16 Posts

Posted - Jan 08 2013 :  11:00:34  Show Profile  Reply
For all who has the same problem.

William Miller sends me a code with that solution, this works fine for me.
Thanks Bill.


var
  i: integer;
  iImageEnIO: TImageEnIO;
  iFolder: string;
  iFilename: string;
begin
  Screen.Cursor := crHourGlass;
  try
    iFolder := 'c:\temp\';
    iImageEnIO := TImageEnIO.Create(nil);
    try
      for i := 0 to ImageEnView1.LayersCount - 1 do
      begin
        ImageEnView1.LayersFixRotations(i);
        ImageEnView1.LayersFixSizes(i);
        ImageEnView1.LayersFixBorders(i);
        iImageEnIO.AttachedIEBitmap := ImageEnView1.Layers[i].Bitmap;
        iFilename := iFolder + 'Export' + IntToStr(i) + '.jpg';
        iImageEnIO.SaveToFileJpeg(iFilename);
      end;
    finally
      iImageEnIO.Free;
    end;
  finally
    Screen.Cursor := crDefault;
  end;
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: