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 9181441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:18:52+00:00 2026-06-17T18:18:52+00:00

I am trying to make tiles for a game using a larger background image

  • 0

I am trying to make tiles for a game using a larger background image and cropping them, but after saving the first 17 images I start running into problems. The 18th image is blackened out at the bottom and the remaining images are all black. Any thoughts?

Here is my code. imagesize=(512, 512), tilesize=(32, 32)

def __init__(self, path, imagesize, tilesize):
    self.tiles = dict()
    self.backimage = Image.open(path)
    self.backimage.resize(imagesize)
    self.x = imagesize[0]/tilesize[0]
    self.y = imagesize[1]/tilesize[1]
    currx = 0
    curry = 0
    for i in range(self.x):
        for j in range(self.y):
            tmp = path + str(i) + "_" + str(j) + ".png"
            self.tiles[(i, j)] = tmp
            image = self.backimage.crop((currx, curry, currx+tilesize[0], curry+tilesize[1]))
            image.save(tmp, "PNG")

            curry += tilesize[1]
        currx += tilesize[0]
  • 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. Editorial Team
    Editorial Team
    2026-06-17T18:18:53+00:00Added an answer on June 17, 2026 at 6:18 pm

    You’re not resetting curry at the end of the j loop. It just keeps increasing until it’s out of bounds.

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

Sidebar

Related Questions

Well, I'm trying to make a graphical game for the first time, but: BufferedImage
I'm trying to make a basic (Mario style) game but my sprite(plumber) doesn't appear,
I am trying to make a tile game that has 6 tiles in each
I'm trying to make a game in HTML5 canvas, but instead of uploading a
I'm trying to make a small game using (free)GLUT. I know that it's old
Basically i'm trying to make a tic-tac-toe game using C++ and SFML2 API. I
I'm trying to make a map with repeated images, and I also want tiles
I've been trying to make a poker game bot for IRC, but I can't
I am trying to make a simple tile system for my game. I made
I'm trying to make a rpg game, and I want to show a tiled

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.