• Advertisement
Sign in to follow this  

How do I find out size of a frame in an image?

This topic is 3292 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm new to programming, I am going to use some freeware art from the web. My goal is to make a 2D player that walks around the screen. All the frames are on one image, it appears the artist have lined them up in a grid, but how do i get the width/height of them?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by DrinkMoreWater
I'm new to programming, I am going to use some freeware art from the web.
My goal is to make a 2D player that walks around the screen. All the frames are on one image, it appears the artist have lined them up in a grid, but how do i get the width/height of them?
Offline, you can just manually count the number of pixels from one frame to the next.

If you want to do it at runtime, you have a couple of options:
1. Hard code the number of columns of frames, and when you load the image you can tell grid_size = image_width / num_colums;
2. Give each grid cell a magenta or other "obvious" coloured border, then read the pixels from the frame up until you hit magenta.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement