image import, image resize, and performance

0 favourites
  • 4 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hi All,

    I tried to find this in the forums, but no luck...

    I'm trying to get a better sense of how imported images perform at runtime based on size. I'm not talking about filesize or using different image formats or compression, but strictly height X width in pixels.

    Ashley has already given me a great explanation of how images are converted to PNG-32 for use in the editor, and then can be exported to PNG-32, PNG-8 or JPG for final projects. What I'm after now is a best approach to sizing (height, width) an image for import into C2.

    So here are three cases where an image is imported into a new sprite object:

    1) A 128x128 image is imported and used at full size in the image editor and layout

    2) A 256x256 image is imported, then immediately resized in the image editor to 128x128, then placed in a layout

    3) A 256x256 image is imported, then placed in a layout, then resized in its object properties to 128x128

    Can anyone tell me what the runtime differences are (if any) between these cases? I'm asking because I would expect case #1 to offer a performance benefit over #2 and #3. I would also think maybe there's a performance benefit to #2 over #3. I say this because I'm thinking that the larger image is stored and used at runtime in case #3, but not necessarily in cases 1 and 2.

    It would be useful to know what the differences are between the cases (and if there are specific or general performance benefits).

    Basically, If I have to, I'll get all my artwork down to the smallest usable height and width before I import it into C2, but it would be nice to know whether that's required.

    Thanks for any help, and as always, thanks for a great product and great user community!

  • 1 and 2 end up being the same, a 128x128 image. Case 3 just makes the file size bigger.

    Using smaller graphics gives a negligible performance increase if any. Using bigger images just increases the download time for your game.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Optimisation - don't waste your time

    Providing hardware acceleration is in use, there is no difference between any of these options. It is probably of more concern to you how the source image size affects the download size.

    From Performance Tips in the manual:

    ommon misconceptions

    ...

    Size, angle or opacity of sprites/tiled backgrounds and floating-point positions (e.g. positioning a sprite at X = 10.5) has no effect when hardware acceleration is in use. This may be a little surprising or counter-intuitive, but modern graphics cards can usually render a sprite at the same speed regardless of whether it is tiny or huge (fullscreen or even bigger) and regardless of its angle, opacity or position.

  • Thanks R0J0Hound and Ashley. Sorry to waste time on something that's already available. I swear I did actually read the performance tips section a while back. Oh well, I'll read more carefully next time.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)