How do I find out size of a frame in an image?
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?
Quote:Original post by DrinkMoreWaterOffline, you can just manually count the number of pixels from one frame to the next.
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement