Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 143657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:07:48+00:00 2026-05-11T08:07:48+00:00

I have this sprite sheet: How can I read this image file to extract

  • 0

I have this sprite sheet:

Pacman sprites

How can I read this image file to extract part of it to be used as a sprite ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:07:49+00:00Added an answer on May 11, 2026 at 8:07 am

    If the sprites area read into a BufferedImage, the getSubimage method can be used to get a subimage of the sprite sheet.

    The getSubimage method will take the x, y, and the width and height of the desired subimage, so the desired sprite can be obtained. Since most of the sprites seem to be the same size, I would think most of them can be retrieved by a nested for loop to iterate through the large image.

    For example, if the sprite image is loaded using the ImageIO class (such as the read method), and each sprite is 10 pixels by 10 pixels in size, where are 5 rows by 5 columns of sprites, the sprites can be obtained by the following:

    BufferedImage bigImg = ImageIO.read(new File('sheet.png')); // The above line throws an checked IOException which must be caught.  final int width = 10; final int height = 10; final int rows = 5; final int cols = 5; BufferedImage[] sprites = new BufferedImage[rows * cols];  for (int i = 0; i < rows; i++) {     for (int j = 0; j < cols; j++)     {         sprites[(i * cols) + j] = bigImg.getSubimage(             j * width,             i * height,             width,             height         );     } } 

    The catch is, of course, the above code will only work if all the sprites are the same size, so there will need to be some adjustment performed in order to work for the given sprite sheet. (As the top right-hand corner seems to be different in size from the others.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSS image sprite and this renderes perfect in FF, also IE.
I have a sprite sheet which has each image centered in a 32x32 cell.
I bump into something like this quite often. This time I have sprite sheet
This is how I create a sprite with texture form a sprite-sheet. But how
So, I'm looking to do a background image in CSS using a sprite sheet.
I have been attempting this for a few days now. I'm creating a sprite
Oky i am supplying this variable to animate a sprite sheet in andengine. player.animate(new
I have a one spritesheet image with all sprites, I downloaded this image from
I have this: public class Sprite { protected float x; protected float y; protected
I have this setup: A layer has a sprite as a child. The sprite

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.