Re: Copying Format1bppIndexed Images



Either the image is a NULL reference or the Graphics is a NULL reference.

I suggest that you try to save the 1bpp image as a bitmap and then try to
open it from your file directory by clicking on the image.

If it displays correctly, then the problem is with your display code.


"Tom Bean" <tbean@xxxxxxxxxxxxxxxx> wrote in message
news:%23BmAumC$FHA.344@xxxxxxxxxxxxxxxxxxxxxxx
> That took care of the resolution problem but when I try to load the new
> bitmap in a PictureBox, the system throws a NullReferenceException in
> GdipDrawImageRect(HandleRef graphics, HandleRef image, Int32 x, Int32 y,
> Int32 width, Int32 height) which was called by Graphics.DrawImage(Image
> image, Int32 x, Int32 y, Int32 width, Int32 height).
>
> Do you know what could be causing this?
>
> "Michael Phillips, Jr." <mphillips53@xxxxxxxxxxxxxxx> wrote in message
> news:uuBoG7B$FHA.3568@xxxxxxxxxxxxxxxxxxxxxxx
>> Assuming that your source image has a resolution of 204 DPI by 196 DPI,
>> then use SetResolution to set the new Bitmap's resolution to match the
>> source.
>>
>>
>> "Tom Bean" <tbean@xxxxxxxxxxxxxxxx> wrote in message
>> news:OUWM$iB$FHA.3872@xxxxxxxxxxxxxxxxxxxxxxx
>>> Michael,
>>>
>>> One of the problems with the method you suggested is that the new bitmap
>>> is created with a HorizontalResolution and VerticalResolution of 96,
>>> whereas my original image had a HorizontalResolution of 204 and a
>>> VerticalResolution of 196. If possible, I would like to preserve the
>>> resolution of the images.
>>>
>>> Do you have any suggestions about how I can use this method and keep the
>>> higher resolution?
>>>
>>> Tom
>>>
>>> "Michael Phillips, Jr." <mphillips53@xxxxxxxxxxxxxxx> wrote in message
>>> news:eermB74%23FHA.160@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Assuming that you are checking to make sure that you
>>>> have a PixelFormat1bppIndexed image when you
>>>> call SelectActiveFrame, use Lockbits to obtain the BitmapData
>>>> and then create a new Bitmap with the constructor
>>>> Bitmap(int width, int height, int stride, PixelFormat format, IntPtr
>>>> Scan0)!
>>>>
>>>>
>>>> "Tom Bean" <tbean@xxxxxxxxxxxxxxxx> wrote in message
>>>> news:OS92Yn3%23FHA.2676@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> My application breaks multi-page faxes into a collection of images,
>>>>> one for each page. The faxes are saved by our fax software as
>>>>> multi-frame TIFFs with a pixel format of Format1bppIndexed.
>>>>>
>>>>> While processing the pages, I am creating a new Bitmap of each frame
>>>>> and found the new Bitmap had a pixel format of Format32bppArgb. As a
>>>>> consequence of the change from Format1bppIndexed to Format32bppArgb,
>>>>> the page images are much larger and are causing out of memory errors.
>>>>>
>>>>> How can I copy the page image, after calling SelectActiveFrame(), so
>>>>> the Format1bppIndexed pixel format is preserved?
>>>>>
>>>>> Thanks,
>>>>> Tom
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: Office 2001 --> office 2004
    ... "placeable header", usually a low-resolution bitmap. ... resolution, ...  the issues in graphics between 2001 and 2004 were never ... McGhie Information Engineering Pty Ltdhttp://jgmcghie.fastmail.com.au/ ...
    (microsoft.public.mac.office.word)
  • Re: Copying Format1bppIndexed Images
    ... A new image of each page was being created which was verified by saving ... I created the new bitmap using the Bitmap(int ... >> GdipDrawImageRect(HandleRef graphics, HandleRef image, Int32 x, Int32 y, ... >>> Assuming that your source image has a resolution of 204 DPI by 196 DPI, ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Copying Format1bppIndexed Images
    ... That took care of the resolution problem but when I try to load the new ... GdipDrawImageRect(HandleRef graphics, HandleRef image, Int32 x, Int32 y, ... > Assuming that your source image has a resolution of 204 DPI by 196 DPI, ... >> One of the problems with the method you suggested is that the new bitmap ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Is this a known bug with the Bitmap class??
    ... > resolution value returned when opening a .jpg file by passing ... > Image.FromImagestatic function to return a bitmap object. ... public class ExampleClass ... using (Graphics g = Graphics.FromImage(i)) ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Copying Format1bppIndexed Images
    ... I created the new bitmap using the Bitmap(int ... >> Either the image is a NULL reference or the Graphics is a NULL reference. ... >>> GdipDrawImageRect(HandleRef graphics, HandleRef image, Int32 x, Int32 y, ...
    (microsoft.public.dotnet.framework.drawing)

Loading