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

  • SEARCH
  • Home
  • 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 8426199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:28:54+00:00 2026-06-10T04:28:54+00:00

I am trying to scale an image (that is from a sprite sheet) using

  • 0

I am trying to scale an image (that is from a sprite sheet) using this code below.

Point pos = new Point(100, 100); //this shows where to display the image
Rectangle a = getAnimatedPos(); //just gets the coordinates of a specified image (which works correctly)

g.drawImage(img, pos.x, pos.y, pos.x+getWidth(), pos.y+getHeight(), a.x, a.y, a.x+a.width, a.y+a.height, null);

the function getWidth() returns the width of the frame. The formula is (imageWidth/rows).
the function getHeight() returns the height of the frame. The formula is (imageHeight/cols).

When I scale the image (by changing the width or height), it starts to show the other frames? If I leave the width or height of the image to the default size it works. I thought by defining the sources coords and dest coords it wouldn’t do this.

To clarify, the image is being painted/rendered on an internal frame say with the size of 640×480. Also, when I mean frame, I am talking about a sprite sheet and each image in the sheet is a frame. It is for animations of course.

Another thing to clarify, the image is not being drawn on top of components. Just an internal frame.

What should I try to fix this?

Screen Shots

When everything is default this is what it looks like: http://wisemindstudios.com/good.png

When I change something: http://wisemindstudios.com/bad.png

Thanks a bunch!

  • 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-10T04:28:55+00:00Added an answer on June 10, 2026 at 4:28 am

    I spotted the problem. It was in my getAnimatedPos function. I passed in the new width and height of the frame and not the original width and height of the frame (for source coords). So, it was a very simple fix after all.

    I was certain it was something wrong with the drawing and not my code. But, it usually is always the users fault (or programmers in this case). Oh, well. It is what it is.

    Thanks for helping me out!

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

Sidebar

Related Questions

I am trying to scale an image without using the function gluScaleImage which is
I am trying to extract the palette from a 5-6-5 (16bit) bitmap image that
I am trying to export an image from a UIView that contains a UIImage
I am trying out a sample code that converts a color image to grey
I'm trying to save the value of each pixel in a gray scale image
I am trying to position this sale banner over the image. The red border
I'm trying to scale text from 1 to 5, a sort of zoom in
I'm trying the moving limit after zoom with canvas scale, but new coordinates does
I'm trying to crop an image from the media gallery. I'm able to access
I am currently trying to write an application that displays live video from a

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.