[Resolved] 1x1 px image, streched: how much memory does it cost?

if I take a 1x1 px image and strech it to 1024x768 like display.newImageRect(“pixel.png”,0,0,1024,768)
does it take ram memory of a 1x1 image or of a 1024x768 image? [import]uid: 79152 topic_id: 29290 reply_id: 329290[/import]

Good question - not sure, you could just do a memory check and see what happens.

Incidentally, what purpose would this serve? [import]uid: 33275 topic_id: 29290 reply_id: 117761[/import]

Texture Memory usage should not change if you stretch an image, so the memory used for rendering would be the w * h * 4 bytes (assuming 32bit texture format). The Image Rect also takes up a tiny bit of memory, but that amount should be minimal and a consistent value for all imageRects.

But if you are going to use a 1 pixel ImageRect, why not just use a Vector based Rect object and set the FillColor to the desired color? [import]uid: 134101 topic_id: 29290 reply_id: 117765[/import]

I tried to mimic some effect that my artist was getting on photoshop with rects, adding blend etc. but wasn’t quite there. We thought maybe trying to apply some mask with alpha could do the trick better but the thought of a 1024x768 image on my memory gave me shivers. [import]uid: 79152 topic_id: 29290 reply_id: 117868[/import]

Texture memory is based on the image size when it’s loaded in - so if you load a huge image then scale it down to 1 x 1 will be the same - likewise if you load a 1x1 image (really should be 2x2, image dimensions should be even numbers) it will not take up more texture memory if stretched to 1000x1000 etc.

As SegaBoy suggested with this type of questions it’s really easy to just check mem usage -

[lua]local function monitorMem(event)
collectgarbage(“collect”)

print( “\nMemUsage: " … (collectgarbage(“count”)/1000) … " MB”)
print("Texture Usage " … system.getInfo( “textureMemoryUsed” ) / 1000000)

return true
end

Runtime:addEventListener(“enterFrame”, monitorMem)[/lua]

Peach :slight_smile: [import]uid: 52491 topic_id: 29290 reply_id: 117869[/import]

Thanks everyone [import]uid: 79152 topic_id: 29290 reply_id: 117921[/import]