Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6548757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:00:32+00:00 2026-05-25T12:00:32+00:00

I’m writing an app whose purpose is to find images within a folder and

  • 0

I’m writing an app whose purpose is to find images within a folder and present them to the user asking how they should be cropped. With all of the jumping I do from language to language on a daily basis, I tend to get my best practices and concepts jumbled up, and this is such a case.

Program flow goes like this: you’re presented with the main form, with a browse button (that you could alternatively drop a folder onto). When you select a folder, it opens another form that scans the selected folder for .jp[e]g and .tif[f] images and presents them in a list, asking which of them you’d like to crop, and some other options. Then it goes back to the main form which goes through the list of selected images from that form, and within a BackgroundWorker for each one it loads it into a cropping form, then crops it and saves it.

For prototyping I handle the loading of images a bit messily; it loads all the images in the folder for the selection form, then it loads each selected image again in the cropper one-by-one, and then one more time in the main form to be cropped and saved. For large images, this could make the task time-consuming, as this app would handle TIFF source images up to about 4000px2 in a worst-case scenario.

I would like to think that there is a way to just load each Bitmap once into some sort of global array, but that would be Visual Basic or VB for Applications. Since I’m using a BackgroundWorker I also have to worry about thread safety and whether or not C# will yell at me about trying to access something in an unsafe manner. Any ideas as to how I can accomplish the app’s purpose while limiting the number of times a single image is loaded into a Bitmap object?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:00:33+00:00Added an answer on May 25, 2026 at 12:00 pm

    Since according to Microsoft the Bitmap class instance members are not guaranteed to be thread-safe I see 2 options:

    • performant but a bit risky
      Load everything as a Bitmap object and add all those Bitmap objects to a ConcurrentDictionary… the access is thread-safe and very fast since the implementation is mostly lock-free…

    • a bit less performant but not risky
      Load all files as MemoryMappedFile into a ConcurrentDictionary. when you need a Bitmap you just create a MemoryMappedFile (which will use the same memory already occuppied by the onece you created before thus extremely fast) and let the Bitmap load its content from there… when your app shuts down or you want to cleanup you just go through the Dictionary and get rid of those MemoryMappedFile objects…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.