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.

Newcomers DBPro Corner / find image height and width?

Author
Message
RebirthAnime
21
Years of Service
User Offline
Joined: 11th Oct 2002
Location:
Posted: 20th Mar 2004 04:46
Hey..I'm not really a newcomer, but I sorta am because I haven't programmed in a while and haven't tried anything like this, but I'm making a little image viewer scaler program that loads and sets the window size to the width of a sprite currently. I'm loading an image, then making it into a sprite and making the window the size of the sprite, although it's not working correctly on some larger images, the edge of the window is in a bit from the edge..I'm not exactly sure why it would be doing that, but I was thinking if there was a way to check for the width ad height of the image, maybe I could just use that value as the width and height of the window. So does anyone have any ideas on how to accomplish this? It'd really help me out a lot being I'm sorta stuck and not sure how to do what I need without fixing the window sizing. Thanks
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 20th Mar 2004 04:57 Edited at: 20th Mar 2004 04:59
heres a function that I use to get image width and height:



Its real time creation and deletion of memblocks and such, so its not the fastest. For your application you could probably change it and make it faster. The main lines are marked. They get the info from the image data.

"All programmers are playwrites and all computers are lousy actors" -Anon
RebirthAnime
21
Years of Service
User Offline
Joined: 11th Oct 2002
Location:
Posted: 20th Mar 2004 05:56
well actually..I can't get that to work with it either..hmm..it's still doing the same image thing, and now it's making the window start off REALLY small..like..just the blue top bar, you have to type 1 for fullsize and enter it to show anything..here's my code..it'll work with any image (cause I dont' have specific ones for it) you should only have to have the image in the same folder as the program..maybe I set up the set window size stuff up wrong or something..I'll keep trying stuff, but tell me if you see anything wrong that might do that please...thanks
andrew11
21
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 20th Mar 2004 18:08
Heres code that shoul work. You put a 1 where Image should be in the function name.

"All programmers are playwrites and all computers are lousy actors" -Anon
RebirthAnime
21
Years of Service
User Offline
Joined: 11th Oct 2002
Location:
Posted: 20th Mar 2004 18:17
arg...still not showing all of the image...hmmm..
RebirthAnime
21
Years of Service
User Offline
Joined: 11th Oct 2002
Location:
Posted: 20th Mar 2004 18:21
ah ha...it has to do with my scale sprite command...I'm not sure if it's working with other images correctly, but at least I know that that's what's causing the problem I think...I shrunk it to 60 and it all showed up right.hmmm
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Mar 2004 19:52
You can install the Matrix1Extend1 plug-in from my site. Amongst other things, it has GET IMAGE WIDTH() and GET IMAGE HEIGHT() functions.

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk

Login to post a reply

Server time is: 2024-09-22 03:00:32
Your offset time is: 2024-09-22 03:00:32