Rob's Image Shrinker

The Discussion

  • User profile image

    I made an earlier post about the threading issue without having fully read the article.  Please accept my apologies, as I see now that you have already addressed the issue.  Thanks for your efforts in putting this out there / educating us.

  • User profile image

    I tried converting about 6 dozen images that started out at 6 megapixels (3072 x 2048; approx 1.8 MB each) and targeting them for my Sony Clie (Palm) PDA (320x320).  After about 1 minute of operation, I received this diagnostic from the debugger:

    ---begin snip---

    ContextSwitchDeadlock was detected

    Message: The CLR has been unable to transition from COM context 0x1a0428 to COM context 0x1a0598 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

    ---end snip---

    I also ran out of Virtual Memory and got an OutOfMemoryException (unhandled).

    It would be really good if you could deal with the threading issue.

  • User profile image
    Rich L

    I've used this but adapted it watch a folder and convert the images into two folders and two separate sizes. Only problem is it is leaving a black line at the top where it has maintained the aspect ratio. Any ideas how to stop this?

  • User profile image

    Your program is interesting but compact framework doesn't have folderbrowserdialog class and the openfiledialog is not as flexible as you think. Greetings

  • User profile image

    The colors will change if the source image is in CMYK colors. For me #ffffff changed to #fdfdfd

  • User profile image

    Some white area (#ffffff) inside the picture changed to #fdfdfd after resizing. How can I get it to keep the exact color?

  • User profile image

    It is a very good idea to set the graphics.InterpolationMode = InterpolationMode.HighQualityBicubic or Bicubic.

    The default resize method in the .NET framework is the same ( fast ) method that IE uses when down scaling images. This will leed to a poor result in many cases.

  • User profile image
    M. Amer

    Very interesting utility. I liked the way you explained the code. As a teacher, my hat goes to you.

    M. Amer

  • User profile image
    SoCal Sam

    Just used your article to create some F# material.

    Thanks, it is still working!

Add Your 2 Cents