Maximum size of Image using (in simulator)

Hi ya,

I am using to grab an image of the group I am interested in. I have got control of the size of the image dumped on the simulator and device so that’s great. However I need high resolution (large) images of the group as they are to be printed out on large scale. A couple of questions

  1. What controls the maximum size of the image that can be grabbed and how do you determine that in code. (if you grab too large an image its just seems to be black)

  2. If I require larger images than the device can allow, is breaking the group into chunks grabbing images of the chunks and patching the resultant images back together the only way to achieve the larger image. Any other ideas or solutions welcomed.

Many Thanks

(I modified your title to be a little more clear. You mentioned the simulator in your post, but the title didn’t make it clear. So, some might think you meant limit on devices.)

  1. What controls maximum size … IIRC the size of the image saved when calling on the simulator == Simulated Device Resolution X Simulator Zoom

I’ll try to verify this, but if you have a test case set up, this is something you can test on your own quickly.

Please note, for the Windows Simulator (and probably OS X) you cannot scale the simulator window larger than the PC/Mac screen resolution. So that is the final limiter.

Again, I’ll try to check on this later and if I find out more or am wrong I’ll post back.

  1. If I require … - I don’t have an answer for this question.

Hi roaming gamer
I am sorry for the confusion I mean devices the app runs on. I realised early on the simulator was just that a simulator. I am not sure how the works… I was assuming it relates to the frame buffer or something but didn’t know how to determine in code. Any advice you can provide is very much appreciated. I have tested and grabbing an image greater than 4000 pixels wide and high generates darkness (using iPhone 11 and Mac Book Pro Catalina). I am currently looking at seeing if I can do what I want in vector graphics (SVG) but would prefer to stay with bitmaps if possible. Sorry for the confusion on the simulator and thank you for looking and responding I look forward to any ideas.

Hi. As I read your posts, you’re mixing contexts and concepts. That said, I’ll do my best to help.

Tonight, when I’m done w/ my day job I’ll run a few tests doing various kinds of ‘screen’ captures and then respond to this post w/ some samples and notes. Hopefully this will help you.

In the interim, could you please answer a question for me.

You said, you wanted to print these images. Can you please give me more details on what you are using these screen captures for?

Most people do screen captures to create images for their store listings. It doesn’t sound like that is what you are doing.

Knowing better your end usage and goals might help direct my assistance efforts.

1 Like

Hi ya Roaming Gamer

Thank you so much for your thoughts. I am interested to understand what is doing under the hood so that the app can work on any device and can be coded to provide the true capability of the device in question. I am just not sure what the actual limitation is on a device texture memory etc no idea. I have finished a vector (SVG based version) it works but is slow to save but obviously offers infinite resolution when it comes to printing.

The app is a a high quality painting programme hooked up to a print shop api back end so that users can paint things as a pastime. Its a mix of diamond painting based, painting by number and wavelet painting algorithm (to provide levels of detail) hooked up to print shop back end so people can also generate physical products like posters and other stuff, as gifts, instead of just staying virtual on your phone. The resolution required is determined by the physical diamond/pixel size and the viewing distance but that depends on device capability. Hope that helps.

I attach a typical image it generates currently.

Thanks for your time look forward to moving this forward !

OK. I was wrong. Actually I was thinking of a different function.

I believe the limit is equal to:

local maxTextureSize = system.getInfo( "maxTextureSize" )

OR… more likely one power-of-two size less than that.

Here is a test app to test (maximum dimension) sizes from 1024 … 32,768:

(Uses SSK for some parts to keep writing the test app simple for me: )

On my system (running in simulator), the maxTextureSize == 16,384, but I was only able to save up to 8,192 x 8,192 sized textures with The 16K size save failed.

One last note. I expect on all modern devices you should be able to save at least a 4K x 4K image and probably 8K x 8K on most Apple devices.


In my example, I used your image above as the source and got these JPG save sizes (using default quality):

JPG Save

  • 1K - 261B
  • 2K - 967B
  • 4K - ~3MB
  • 8K - ~8MB

PNG Save

  • 1K - 3MB
  • 2K - ~12.6MB
  • 4K - ~43.3MB
  • 8K - ~160.3MB

These values will vary by image.

Hi ya Roaming gamer

Firstly thank you so very much for looking into this. I thought it might be the texture memory size driving the limits but I could not find in solar 2D how to access it on a device, but that call you provided is exactly what I needed.

I had a look at your code (by the way that SSK module looks very useful I had not seen it before), because of content scaling, when you grab an image in the code say 8192x8192 the actual image delivered is 14400x14400. The 14400 is because the is working in device coordinates instead of context coordinates. The calibration/scaling factor is simply display.contentWidth/display.pixelWidth assuming linear scaling in x and y . So when you correct for the scaling factor you actually get the correct image size saved. I changed your code to math.floor(imageSizeRequired*display.contentWidth/display.pixelWidth) to get the correct size image. Once you have corrected this you can save an image 16384x16384 on a 16384 device. You have to be careful on the scaling factor though as rounding can push you one pixel over texture memory size and darkness ensues. Thanks so much again for your help on this. I will look into ssk as it looks very useful stuff. Thanks again David

By the way I also stress tested the devices ability to cope by loading a number of large different images to the test image. You can still dump a full size image without any problems on an iPhone 11 under stress. Hope this helps. David