Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Help with image width

Author
Message
VG Teacher
14
Years of Service
User Offline
Joined: 27th Oct 2011
Location:
Posted: 27th Oct 2011 15:38
Hello, I am new. I am using DBPro. Here is my problem:

I cannot get my program to tell me the width of an image. My code runs fine, including loading images, without my line of code to find the width.



The code compiles with the bitmap width command, but does not execute. I get error message 1002 - Bitmap does not exist at line 24.

I have also tried some code I saw on youtube, using the image width and image height:


..but then I get the following error:

Could not determine parameter type of 'image width (2)' at line 24

Thank you in advance for your help!!!!!
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 27th Oct 2011 15:54
Try this:



Cheers.

I'm not a grumpy grandpa
VG Teacher
14
Years of Service
User Offline
Joined: 27th Oct 2011
Location:
Posted: 27th Oct 2011 16:00
Thank you, chafari, but I am getting the same error message -

Could not determine parameter type of 'image width (2)'

My DB Pro does not seem to recognize "image width". I also tried your code with bitmap width, and again got the bitmap does not exist error.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Oct 2011 16:02
The following code works perfectly for me. Perhaps you have an old version of DBPro before the image width() functions were introduced? They don't seem to be listed in the original manual.

VG Teacher
14
Years of Service
User Offline
Joined: 27th Oct 2011
Location:
Posted: 27th Oct 2011 16:10
Maybe I am working wtih an older version. I have 1.054. I copied and pasted the above code, with no success.

I am stuck with it, I am a teacher and am working with what I have on my machine until I get new software next fall.

Any other ideas to get around the issue?

Thanks again for all of your help! Maybe some suggestions for the bitmap width?
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 27th Oct 2011 16:42
If you can't upgrade your software then you will have to make do with converting the image into a sprite; and use [Sprite Width()], or use [Load Bitmap] and use [Bitmap Width()] which did not work in your code because you used [Load Image], thus the bitmap did not exist as these are treated as seperate classes.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Oct 2011 17:00
Quote: "Maybe I am working wtih an older version. I have 1.054."


That's a very old version. In the meantime do what Chris Tate suggests, i.e. something like this should work:

VG Teacher
14
Years of Service
User Offline
Joined: 27th Oct 2011
Location:
Posted: 27th Oct 2011 17:38
Thank you, everyone!

Green Gandolf,
I was missing the set current bitmap 0

Now my code runs as expected
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 27th Oct 2011 18:11
@ Green Gandalf:

I remember back when the IMAGE WIDTH() and IMAGE HEIGHT() commands were undocumented but they still worked... his version is ancient.


@ VG Teacher:

Unfortunately since you're doing this at school you can't use the free version... but you should be allowed to download and install the Darkbasic Pro update.

http://www.thegamecreators.com/?m=view_product&id=2000&page=upgrade7-61

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 27th Oct 2011 18:33
Yes, but in a college environment there may be hundreds of machines invoved and there are usually administrative procedures to ensure that software is installed/upgraded in an orderly fashion across all machines. So a simple upgrade might not be so straightforward as it is on a single home machine.

Login to post a reply

Server time is: 2026-07-10 16:57:37
Your offset time is: 2026-07-10 16:57:37