Hello, I am in the process of making an application for OSX and Windows in which the user needs to load images typical of >500 mb, 2800x7000 resolution. For starters, if I recall, REAL basic has a limit of 32,000 pixels horizontal or vertical resolution, so we won’t focus on images of that resolution.
The general idea is that the image is loaded onto a canvas, and the user can scroll and zoom around and click on points of interest, generating a circle at the mousedown point and a tally recorded in a listbox.
My application is completed, and works, however it needs to be optimised to run on older slower machines. Testing on a 2.1 Core 2 Duo 4 GB RAM macbook, the application cannot draw a 70 MB photo to the canvas, and crashes. On a built PC, I can load images upwards of 500 mb.
Currently I am loading the picture into a global Picture property to keep it in the RAM for fast access. My scrolling and zooming are done through the Canvas.Paint event using g.DrawPicture. I found it easier concerning scrolling and zooming to draw the picture to the canvas using g.DrawPicture. Should I think about using the canvas backdrop instead?
My main question is if I am storing the picture in a property, and then I draw it to a canvas, does the canvas only store the bytes of the image that are within the bounds of the canvas? If not, does the entire image get reloaded into the canvas, meaning I am storing the same image twice over; once in the global property and once in the canvas?
In general, if anyone has any tips or pointers as to how I’d go about efficiently loading a very large image into a Canvas for user editing, that’d be awesome!
(On a side-note, if I try to export a large (70 MB, 28,000X7,000) picture using the SaveAsTIFF/JPG etc., the program crashes even if I have purged all of the its memory first. Is the SaveAs function limited by the API it calls or by the computer (I have tried running it on a current gen fully built gaming PC, and it still crashes until I scale the resolution down to ~20,000x6000)?)
Thanks!