Stream vs .image property for loading an image element inside an array of objects

LaughingSeraphim

New member
Joined
Aug 16, 2016
Messages
3
Programming Experience
1-3
I will most likely be storing my bluepprints in here.

C#:
 [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]class[/COLOR] [COLOR=#004085]ImageInfo[/COLOR]
 {
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000][B]double[/B][/COLOR] [I]DPI_X[/I];
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000][B]double[/B][/COLOR] [I]DPI_Y[/I];
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000][B]double[/B][/COLOR] [I]Pixels_X[/I];
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000][B]double[/B][/COLOR] [I]Pixels_Y[/I];
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000][B]int[/B][/COLOR] [I]Inches_Wide[/I];
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000][B]int[/B][/COLOR] [I]Inches_Tall[/I];
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#004085]Image[/COLOR] [I]BluePrint[/I];
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] [I]OldFileName[/I];
     [COLOR=#0000ff][B]public[/B][/COLOR] [COLOR=#ff0000]string[/COLOR] [I]NewFileName[/I];
     
 }

and assigning each image during the point when FileOpenDialogue has been pressed

Now, I currently stream the files in so that I can rename them locally.(They will also be copied onto a network drive for online distribution here pretty soon)
Each drawing take roughly 1.5-3(1-40Megs each Tiff) seconds to load up, another second to process for preview. (80-600)images per set, dozens of times a day. Seconds totally matter for us here.

C#:
[COLOR=#004085]FileStream[/COLOR] fs = [COLOR=#008b8b][B]new[/B][/COLOR] System.IO.[COLOR=#004085]FileStream[/COLOR]([COLOR=#0000ff]""[/COLOR] + nowname, [COLOR=#004085][B]FileMode[/B][/COLOR].[I]Open[/I], [COLOR=#004085][B]FileAccess[/B][/COLOR].[I]Read[/I]);
              [I]BackBuffer[/I].Image = [COLOR=#004085]Image[/COLOR].[COLOR=#191970][B]FromStream[/B][/COLOR](fs);
              fs.[COLOR=#191970][B]Close[/B][/COLOR]();

However, My question is, if I loop through them and do something like this...

C#:
ImageInfo[i].BluePrint = (IMG at file location);
Will the image be nameable on disk in ?(i.e. loading from file locks that file when it is assigned directly to a picBox Control, is it the same when doing it this way)?

My other theory on quicker loading is this:
C#:
BackBuffer.image = (FileAtLocation)
ImageInfo[i].BluePrint = BackBuffer.image;

If the BackBuffer.image changes, does every element in that object change along with it (are they linked or bound?), or will each assignment remain even when backbuffer is assigned.
i.e. I assign file named A019.tif tp BackBuffer, then assign that to ImageInfo.Blueprint[0];
I then assign file m101.tif to Backbuffer, then assign that to ImageInfo.Blueprint[1],

is imageInfo[0].BluePrint now going to become same image as [1]?


If I can get a little more speed when pre-processing images by not streaming them in, it would save hours each week at my job.

I am a little afraid to start beating up my code until I gather this information, as once I do, the current build will probably cease functioning. I've looked quite a bit at the api and other answers(learned tons), I'm still not sure about these aspects.
If I need to just code up that progress bar and accept stream as my fate, I just want to know that before I break my code.
 

Latest posts

Back
Top Bottom