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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controlling Picture Dimension on image control

Status
Not open for further replies.

gbaja

Technical User
Apr 7, 2009
9
GB
I find it difficult to control the dimension of picture to be displaced on Image control. Can somebody help pls.?
 
yes I did all that, but I am talking about the size in terms of KB of MB. I want to make sure the picture is less than may be say 50KB.
 
In that case, this is not a Visual FoxPro problem. You need to use a graphics editor or paint program (my own choice would be Paint.Net). That will give you several options. You could resize the picture, or reduce its colour depth, or (depending on the file type) reduce its quality. Any or all of those will reduce the size of the file.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
yes, I need the code that will ensure that users resize their pictures to the reguired size before displaying the picture on the image control.
 
So, you're saying that you want your VFP program to make the file smaller? VFP itself can't do that. The only things you can do is to find a graphics editor that you can run as an Automation server, or possibly see if you can do it using GDI Plus.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Not really, for example a message will be displayed as "make sure your picture is 30KB or is of 160 X 180 (dimension)". Now my program should ensure that the user display a picture of the reguired size or dimension. Thank you for your response.
 
I want my application to actually receive picture from users and save in a table. Now in trying to control the size of pictures in terms of KB or dimension to be submitted by the user I need ur assistance. I would need the user to only scan a picture and resize to a size I may reguire (not to use my application for resizing). The application should actually ensure that the picture is in a reguired size before it can save the image.
 
OK, let me make sure I've got this right now. You receive a file from the user, and you want to determine its size. You need both the physical file size, and the dimensions of the image contained in the file.

If that's correct, it's got nothing to do with the scanning, and nothing to do with the Image control. It's just a simple file operation.

To find the physical size of a file, you use ADIR(). Pass an array name (the array doesn't have to exist at that point), and the file path and name. The second element of the array will then contain the file size, in bytes. Example:

Code:
ADIR(laTemp, "c:\data\test.jpg")
? laTemp(2)

To find the image dimensions, you can use LOADPICTURE()

Code:
loPict = LOADPICTURE("c:\data\test.jpg")
? loPict.Height
? loPict.Width

Would that be what you are looking for?

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Wow! Mike you r the bomb. Thank you so so much.
 
Mike, really enjoyed your assistance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top