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
 Most effeceient way to split an image in two parts

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
yogiyang Posted - Oct 15 2013 : 08:23:00
Hello,

I am trying to Load an image which is very bulky (around 150 MB) and the split it (horizontally or vertically) into two parts.

Currently I am loading the image, and then cropping it by using Crop. After this I save the file to a different name. Then I reload the image and then Crop it again from the other part.

This process at times seems to take ages, esp. with large images.

Another thing I would like to know if there is any way by which one can split an image (horizontally or vertically) using percentage like in ImageMagick.

TIA



Yogi Yang
8   L A T E S T    R E P L I E S    (Newest First)
yogiyang Posted - Nov 02 2013 : 07:47:53
Hi,

Thanks for your tip. I will try that also and see which is better for me to use.

Regards,




Yogi Yang
xequte Posted - Nov 01 2013 : 13:22:33
Hi Yogi

That will work OK, but it does mean holding extra images in memory.

How about:

1. Create three TIEBitmaps
2. Load the image into the first TIEBitmap
3. Use CopyRectTo to output the left portion to the second TIEBitmap, and the right portion to the third TIEBitmap

http://www.imageen.com/help/TIEBitmap.CopyRectTo.html

4. Save the second and third TIEBitmaps


That should be the fastest method

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Oct 31 2013 : 05:54:46
I am thinking on another line:

1. Load Image in ImageEn
2. Set Undos to 10
3. Save Undo
4. Crop the image (from Left to Middle)
5. Save Image to a file
6. Undo
7. Crop the image (from Middle to Right)
8. Save Image to a file

What do you say? Is this method advisable or not?

TIA




Yogi Yang
xequte Posted - Oct 24 2013 : 01:06:10
Your method is OK then, but it should be faster if you do not load the image twice. Try it this way:

1. Load the image into ImageEn
2. Create a second bitmap
3. Copy the desired portion of the image into the bitmap
4. Crop the remaining image in ImageEn
5. Save the image in the bitmap
6. Save the image in ImageEn


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Oct 23 2013 : 22:57:17
No not to copy to another control.

What I want to do is Load a file in ImageEn and then crop if either from Left or Top by exactly 50% (eg. width is 2000 px then it should split at 1000 px) and then save the image under a new name. Again reload the original image and crop it from Right or Bottom and again save the image under a new name.

Regards,

Yogi Yang


Yogi Yang
xequte Posted - Oct 16 2013 : 21:00:36
Hi

> Is there any way by which one can split an image (horizontally or vertically) using percentage.

I assume you mean copy the left part of an image, for example, from the point (0 x 0) to (desired width x height).

In that case it would only be a simple matter of using:

DestBitmap.Canvas.CopyRect(Rect(0,0,iWidth,SourceBitmap.height), SourceBitmap.Canvas, Rect(0,0,iWidth,SourceBitmap.height));


Where iWidth is MulDiv(SourceBitmap.Width, iDesiredPercentage, 100);

Also assumes you have set DestBitmap size correctly.

Is that what you are trying to do? You could use two TIEBitmaps if you need to loading and saving support.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
yogiyang Posted - Oct 16 2013 : 03:46:06
The dimension of large images is around 14400 X 4800 pixels at 200 DPI. Sometimes images can be at 300 DPI also! These images are generally created/assembled in Photoshop.

I would like to repeat a part of my question: Is there any way by which one can split an image (horizontally or vertically) using percentage like in ImageMagick.

I was wondering if there is a way to open partial image instead of full image....

I have observed that ImageMagick is very fast in cropping I don't know as to how though. ):

TIA



Yogi Yang
w2m Posted - Oct 15 2013 : 11:46:47
A 150 MB image is quite large, so the only way you may be able to speed it up is to do your processing in a thread. It will still take some time to process the file, but at least the GUI will continue to operate while the work is done in the background thread.

What are the dimensions of the image?

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html