in

Support Portal

ImageConvert.dll

Last post 10-30-2007 3:00 PM by Ben Hejl. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 10-29-2007 5:42 PM

    • Nezrick
    • Top 10 Contributor
    • Joined on 10-29-2007
    • Patch Code
    • Points 23

    ImageConvert.dll

    I have recently fount that .NET 2.0 will not convert to a grayscale 8 bit pixel format out of the box...

    It seems that the Swift Decoder Demonstrator application that comes with the sd2.dll does this by using ImageConver.dll...  However,,, no documentation was provided on how to use this ImageConvert.dll...

    Is this documentation availiable???  If so,,, where???

    Thanks...

    • Post Points: 4
  • 10-30-2007 8:16 AM In reply to

    • Ben Hejl
    • Top 10 Contributor
    • Joined on 05-11-2007
    • Cherry Hill, New Jersey
    • Interleaved 2 of 5
    • Points 142

    Re: ImageConvert.dll

    We do not provide documentation for the ImageConvert.dll.  For information and code on how to convert an image to grayscale using .NET try this link.

    Filed under:
    • Post Points: 4
  • 10-30-2007 10:24 AM In reply to

    • Nezrick
    • Top 10 Contributor
    • Joined on 10-29-2007
    • Patch Code
    • Points 23

    Re: ImageConvert.dll

    Yeah,,, already tried that...  The key word here is "indexed"...  The link you provided converts to grayscale,,, sure,,, but is VERY slow,,, and is not indexed...  The resulting image still will not work with your software...  There are ways to do this unmanaged to increase performance by an order of magnitude (literally) using bit shifting,,, but still,,, the end result is grayscale,,, not 8 bits per pixel indexed grayscale...

    • Post Points: 1
  • 10-30-2007 11:45 AM In reply to

    • Nezrick
    • Top 10 Contributor
    • Joined on 10-29-2007
    • Patch Code
    • Points 23

    Re: ImageConvert.dll

    ok,,, got it...

    Had to first convert to gray using bit shifting...

    Then used a graphics object to redraw as PixelFormat.Format8bppIndexed...

    Then save to a bmp file...

    The only problem I see now is the large size of the bmp created...  I m sure I can get this to a reasonable size though...

    Z

    • Post Points: 1
  • 10-30-2007 12:30 PM In reply to

    • Nezrick
    • Top 10 Contributor
    • Joined on 10-29-2007
    • Patch Code
    • Points 23

    Re: ImageConvert.dll

    Nope,,, I was wrong...  Forgot that the test app does convertion to gray and indexed for you...

    Still getting the same error...

    "A Graphics object cannot be created from an image that has an indexed pixel format."

    This stops me from being able to create the required format from a jpg in .NET...

    Any more ideas???

    Thanks...

    • Post Points: 4
  • 10-30-2007 3:00 PM In reply to

    • Ben Hejl
    • Top 10 Contributor
    • Joined on 05-11-2007
    • Cherry Hill, New Jersey
    • Interleaved 2 of 5
    • Points 142

    Re: ImageConvert.dll

    What I have done in the past is to create a secondary image where the converted data will be placed:

     System.Drawing.Imaging.PixelFormat imageFormat;
    imageFormat = System.Drawing.Imaging.PixelFormat.Format8bppIndexed;

    System.Drawing.
    Bitmap image;
    image = new System.Drawing.Bitmap(frame.Width, frame.Height, imageFormat);

    System.Drawing.Imaging.BitmapData bmd = image.LockBits(new System.Drawing.Rectangle(0, 0, frame.Width, frame.Height), System.Drawing.Imaging.ImageLockMode.WriteOnly, imageFormat);

     /* Write grayscale image contents into image from original image */

    image.UnlockBits(bmd);

    /* Update pallete to specify a grayscale palette where 0=black and 255=white */

    System.Drawing.Imaging.ColorPalette pal = image.Palette;
    for (int i = 0; i < 256; i++)
       pal.Entries[ i ] = System.Drawing.
    Color.FromArgb(i, i, i);
    image.Palette = pal;

    return image;

    • Post Points: 1
Page 1 of 1 (6 items)
Copyright Omniplanar, Inc. 2007
Powered by Community Server (Commercial Edition), by Telligent Systems