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 Discussion / Get image issue

Author
Message
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 11th Nov 2007 11:30
Okay so I just do not understand this command. I have made a simple object in paint for a paddle and I am trying to load it and grab the image. So I put it in yada yada yada and it says illegal image specified..what am I doing wrong?



Dr. Mannete- OMG It's Zombie's voice, it's so Suave!

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 11th Nov 2007 11:51
You have a problem with the specified area for Get Image: 0,8,12,8 won't pick up anything because the Y sarts at 8 and ends at 8 as well.
Also it is worth mentioning that it needs to be load bitmap for get mage to work, the images is already got if you use load image.

Nya!
Well, yes but - wait, what?
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 11th Nov 2007 11:59 Edited at: 11th Nov 2007 12:04
Oh, well hey thanks INH..I'll quick test run that. Should I just change the end y value to seven then?

Alright, the fact that one command is eluding me is annoying me, this command has always given me troule though.



I'm sure I'm missing something really freaking obvious here.

Dr. Mannete- OMG It's Zombie's voice, it's so Suave!

Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 11th Nov 2007 13:14 Edited at: 11th Nov 2007 13:17
I've made a diagram. I hope it clears things out


basicly x1,y1 is the green dot and x2,y2 is the blue dot

ground rule x1<x2 and y1<y2

Don't look at my sig!
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 11th Nov 2007 18:01
I think so..I've just never gotten this command, thank you..I think I'll be good now.

Dr. Mannete- OMG It's Zombie's voice, it's so Suave!

Zeus
19
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 12th Nov 2007 14:20
Where's my artwork Zombie?

STOP reading my signature!
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 12th Nov 2007 18:08
^
Wrong time, wrong place, wrong everything.

Seeing as Sudoku Arts hasn't noticed that I removed my genius sarcasm:
Sudoku arts, the rabi and Nancy DrewG
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 13th Nov 2007 04:15 Edited at: 13th Nov 2007 04:16
Well..jordan...christmas is coming up and our wonderful squeaky justice is creating some posters for our friends, but I promise you he's working on them. If you do find someone else to help before us go ahead and use it.

on the upside, get image issue gone baby!

Dr. Mannete- OMG It's Zombie's voice, it's so Suave!

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Nov 2007 02:01
Another thing to remember - if you didn't already know - is the end-point inclusive/exclusive thing...

Get Image is basically like the 2D Box command, but whereas Box is end-point inclusive, Get Image is not. Draw a box from 100,100 to 200,200 and the bottom right pixel (200,200) will be lit up.

If you then want to capture that box in an image, you have to remember that Get Image is end-point exclusive, so using:

Get Image 1,100,100,200,200

will not grab the far right column and bottom row of pixels. Instead you need to use:

Get Image 1,100,100,201,201

Example DB Snippet (DBC V1.2):



TDK_Man

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 14th Nov 2007 10:44
Thank you very much all of you and thank you tdk for the explianation. I'll have to run that code when I can get on the main compe but I did read it and understood it, I appreciate you all explaining it to me. GET IMAGE was one of those commands that just threw me. I apologize if this is written fast but its late here in PA and I'm tired after 12 hours of work .

Zomb

Dr. Mannete- OMG It's Zombie's voice, it's so Suave!

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 14th Nov 2007 18:06
@TDK
Really? That's very interesting, i think this will require some rewrites...


Sudoku arts, the rabi and Nancy DrewG
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 14th Nov 2007 22:51
*wakes up from deep sleep for having a day off* what did I miss?

Dr. Mannete- OMG It's Zombie's voice, it's so Suave!

Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th Nov 2007 07:26
@Zombie
TDK pointed out the strange way that get image works.
It isn't very strange when you think about it.
Here's an image that shows what I mean:

Here I've labelled the grid; each number marks the start of a new pixel; all the space between the markers "0,0" and "1,1" is pixel "0,0". So to grab pixel "0,0" we need to say GET IMAGE n,0,0,1,1.
To grab the red square we would say GET IMAGE n,0,0,2,2.

Hope that helps

"You must be someone's friend to make comments about them." - MySpace lied.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2007 07:01
Quote: "It isn't very strange when you think about it."


It would be if your diagram was correct!

As it is, it's misleading. According to that, in your example, to draw the red box you would use:

Box 0,0,2,2

Which is wrong - it's actually 0,0,1,1.

The diagram should actually be:



and then it goes back to being 'strange' again!

If you draw a box from 0,0 to 1,1 then you would expect to have to use Get Image with 0,0,1,1 to grab it, but you don't - you have to grab from 0,0 to 2,2.

TDK_Man

Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 16th Nov 2007 14:39
No, because (the way I see it) when you draw you are specifying the pixels and when you are grabbing an image you are specifying the pixel boundaries.

Sorry if I am confusing people here but it makes it easier for me; then I just need to think "do I need pixels or pixel boundaries here?"

Probably an easier way of explaining would be: if you told the computer to find out how many TCG members are between the ages of 15 to 20; the youngest possible member in that range would be 15 and the oldest possible member would be 19.9 years old.

It works the same way with pixels; grabbing from 15 to 20 would only be able to grab pixels 15 through 19. (you can't have .9 of a pixel)

"You must be someone's friend to make comments about them." - MySpace lied.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2007 15:45
I don't like the idea of pixel boundaries because physically (and in DB) they don't exist. Addressing a monitor, you can only have pixel co-ordinates - starting at 0 (zero).

When X=9 you are talking about the tenth pixel (dot) across. The next dot is X=10 and the 'pixel boundary' between them isn't actually there.

It also begs the question "if you use a 'pixel boundary' for the bottom right corner with Get Image, why not for the top left corner"? The top left is actually a true pixel co-ordinate.

With both the Box and Get Image commands, the parameters used are defining a rectangle on the screen and using the same parameters, the rectangle is a different size. I'm saying that to a newcomer to DB, this is strange behaviour if you aren't aware of what is going on.

But as long as everyone is aware of what is happening and we are all grabbing what we should be grabbing then I suppose it doesn't really matter how we think it's working. The main thing is that our programs work correctly!

TDK_Man

Libervurto
20
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Nov 2007 00:32
Quote: "I don't like the idea of pixel boundaries because physically (and in DB) they don't exist. Addressing a monitor, you can only have pixel co-ordinates - starting at 0 (zero)."

Yeah I just thought the same thing.

Does my second explanation sound better?
Quote: "
Probably an easier way of explaining would be: if you told the computer to find out how many TCG members are between the ages of 15 to 20; the youngest possible member in that range would be 15 and the oldest possible member would be 19.9 years old.
It works the same way with pixels; grabbing from 15 to 20 would only be able to grab pixels 15 through 19 because pixel 20 would exceed the range.
"


sorry TDK, I just want to get a good explanation for why get image is "end-point exclusive".

"You must be someone's friend to make comments about them." - MySpace lied.

Login to post a reply

Server time is: 2026-07-06 00:09:21
Your offset time is: 2026-07-06 00:09:21