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
 Can crop image without visible component?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ali

Iran
39 Posts

Posted - Aug 14 2019 :  03:37:25  Show Profile  Reply
Hi Nigel

1. Can crop image without visible component of imageen (without imageenview/imageendbview)?
Can crop imageen with image standard Delphi?

2. Can change brightness/contrast without visible component of imageen (without imageenview/imageendbview)?
Can change brightness/contrast with image standard Delphi?


Best Regards

Ali Abbasi

xequte

4648 Posts

Posted - Aug 14 2019 :  17:52:54  Show Profile  Reply
Hi

If you load an image into a TIEBitmap (ImageEn's advanced TBitmap class) then you can crop it using:

http://www.imageen.com/help/ImageEn/TIEBitmap.Crop.html

Example:

IEBmp := TIEBitmap.create;
IEBmp.Read( 'D:\SomePic.jpg' );
// Crop the image at position, Top-Left: (20, 20), Bottom-right: (100, 100).
IEBmp.Crop( 20, 20, 100, 100 );
IEBmp.Write( 'D:\SomePic_Cropped.jpg' );
IEBmp.Free;


For other image modifications, attach a TIEBitmap or TBitmap to a TImageEnProc:

http://www.imageen.com/help/ImageEn/TImageEnProc.CreateFromBitmap.html
http://www.imageen.com/help/ImageEn/TImageEnProc.AdjustBrightnessContrastSaturation.html


with TImageEnProc.CreateFromBitmap(myBitmap) do
begin
  // Enhance brightness and contrast, maintain existing color saturation
  AdjustBrightnessContrastSaturation(50, 10, 0);
  Free;
end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ali

Iran
39 Posts

Posted - Aug 15 2019 :  01:22:19  Show Profile  Reply
Hi Nigel

Thank you for your help!

I cannot desire (ideal) crop similar miselect with aspect ratio of imageen for example I cannot select any top-left and bottom-right in run time.
If you have solution for run time desire select by user then advise me.

I think I can change brithness and contrast.

Best Regards

Ali Abbasi
Go to Top of Page

xequte

4648 Posts

Posted - Aug 16 2019 :  00:01:12  Show Profile  Reply
Hi Ali

To adjust a rect so it matches an aspect ratio (e.g. of a TImageEnView) you can use the GetImageRectWithinArea method:

https://www.imageen.com/help/ImageEn/GetImageRectWithinArea.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ali

Iran
39 Posts

Posted - Aug 16 2019 :  07:08:49  Show Profile  Reply
Dear Nigel

Thank you your reply and I will test it.

Please help me for assign jpg (TJPEGImage) to ImageEnIO.
I want to assign stream jpg to ImageEnIO.

Also I want to assign TImage which have a jpg image for send to ImageEnIO

Best Regards

Ali Abbasi
Go to Top of Page

xequte

4648 Posts

Posted - Aug 16 2019 :  19:27:29  Show Profile  Reply
Hi Ali

In the next version, you can assign TImage and TGraphic types directly to TIEBitmap and TImageEnView.

Currently you can use:

  ImageEnView1.Assign( Image1.Picture.Bitmap );
  iebmp.Assign( Image1.Picture.Bitmap );


  jpg := TJpegImage.Create;
  try
    jpg.Loadfromfile( 'D:\_Test.jpg' );
    bmp := TBitmap.Create;
    try
      bmp.assign( jpg );
      ImageEnView1.Assign( bmp );
    finally
      bmp.free
    end
  finally
    jpg.free
  end;


TImageEnIO can be attached to a TIEBitmap. Why do you want to use a TJpegImage and TImageEnIO together (as TImageEnIO already works with JPEG images).

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ali

Iran
39 Posts

Posted - Aug 17 2019 :  14:09:02  Show Profile  Reply
Hi Nigel

Thank you your help, but I cannot use your pervios topic.

Below code working corectly, but I want to do not use savetofile and loadfromfile in two times to below code.
Because I cannot save from image1 to ImageEnIO1 and after change brightness & contrast & saturation then save from ImageEnIO1 to image1.

procedure TPictureForm.UniBitBtn2Click(Sender: TObject);
var
 iebmp : TIEBitmap ;
 jpg   : TJPEGImage;
begin
  jpg:=TJPEGImage.Create;

  iebmp := TIEBitmap.Create;
  ImageEnProc1.AttachedIEBitmap := iebmp;
  ImageEnIO1.AttachedIEBitmap   := iebmp;

  try
   Image1.assign(DBImage);
   Image1.Picture.SaveToFile(DM1.Global_Main_Path+'temp.jpg');
   ImageEnIO1.LoadFromFile(DM1.Global_Main_Path+'temp.jpg');

   ImageEnProc1.AdjustBrightnessContrastSaturation(
   UniTrackBar_Brightness.Position,UniTrackBar_Contrast.Position,UniTrackBar_Saturation.Position );

   ImageEnIO1.SaveToFile(DM1.Global_Main_Path+'temp.jpg');
   Image1.Picture.LoadFromFile(DM1.Global_Main_Path+'temp.jpg');

   finally
    jpg.Free;
    ImageEnIO1.Free;
    ImageEnProc1.Free;
    iebmp.Free;
  end;

end;

Best Regards

Ali Abbasi
Go to Top of Page

ali

Iran
39 Posts

Posted - Aug 17 2019 :  14:32:38  Show Profile  Reply
Hi Nigel

In the next version, you can assign TImage and TGraphic types directly to TIEBitmap and TImageEnView.

If we can copy directly from ImageEnIO to image1 or image1 to ImageEnIO1 then it is very nice!
Similar this is good and simple:
ImageEnIO1.assign (image1);
Image1.assign(ImageEnIO1);

Best Regards

Ali Abbasi
Go to Top of Page

xequte

4648 Posts

Posted - Aug 17 2019 :  19:07:31  Show Profile  Reply
Hi Ali

You can already attach a TImage to a TImageEnIO:

https://www.imageen.com/help/ImageEn/TImageEnIO.AttachedTImage.html


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

ali

Iran
39 Posts

Posted - Aug 19 2019 :  16:48:45  Show Profile  Reply
Hi Nigel

Thanks for your help and my problems for adjust brightness and contrast is completely resolved.


Best Regards

Ali Abbasi
Go to Top of Page

ali

Iran
39 Posts

Posted - Aug 21 2019 :  08:34:06  Show Profile  Reply
Hi Nigel

Please help me I can desire (ideal) crop image with none visual component for example with imageenIO.
I think you send me a simple demo then I can bettet understand.


Best Regards

Ali Abbasi
Go to Top of Page

xequte

4648 Posts

Posted - Aug 21 2019 :  21:33:47  Show Profile  Reply
Hi Ali

// Crop the image at position, Top-Left: (20, 20), Bottom-right: (100, 100). The resulting image will be 80 x 80 pixels
ImageEnIO1.IEBitmap.Crop( 20, 20, 100, 100 );


Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To: