Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear free space from an image 1

Status
Not open for further replies.

swreng

MIS
Jun 22, 2006
90
GR
Dear all,

I would like to do something very simple but i don't know if it possible.

I would like to load an image file from the disk into a bitmap and clear any free space at the right of the image
save it again with the save name.

BitMap bt=new Bitmap(Filename);

I would like your help if there is a way to clear the free space at the right of the image.

Best Regards.




 
Free Space?

Can you show us a sample? Is it a white border or something?
 
Hi JurkMonkey

It is white border at the right of the image.

Imagine that this is an image

01230461615601061051650
15616501560101601065010

the total width is 3 times bigger with white border than the above data.

Best Regards

 
Open an image with paint
If your data are small then you can adjust the image area.
Correct?

Imagine now that you have small width data and a huge image width area.

 
This can be as easy or as hard as you want it to be.

You can either

(A) Detect the white border in the image using low level operations (Not Recommended)

(B) Create a small application which allows you to select the crop area and create a new image from it

(C) If all the image sizes are the same you can create a small app that automatically crops the images.


If you can tell me which of these options you need - I can help you with it. I've done this a few thousand times :)
 
I think that option B,C is not a good idea i need something that do it automatically. The image files are gave me are over than 1000, and the sizes are not the same.

So i must choose the option A

Could you help me with that please?

Best Regards
 
Start by looking at this project



This will give you easy access to the image data where you can actually go through at a low level and detect if the end of the line is continuously white.

This is really not an easy task though - you are dealing with bit level operations on the image and you need to compile with /unsafe enabled.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top