Re: Tiff compression

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks, Bob. I realized after posting that a histogram would do me no good.

I will investigate the image metadata and will post my results.

Thanks again.


"Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%233MLt7K6FHA.2192@xxxxxxxxxxxxxxxxxxxxxxx
>A histogram is only good for an image that employs multiple bits per pixel.
>
> You can only cheat to get the brightness levels of a 1 bpp image. You'll
> never get an accurate (or good) result.
>
> The only real way to detect the situation is to look at the image
> metadata. You can read the property items and figure out from them whether
> the black-level is positive or negative.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Ramuseco Limited .NET consulting
> http://www.ramuseco.com
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tipstricks.htm
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/faqmain.htm
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Peter van der Maas" <pjvander@xxxxxxxxx> wrote in message
> news:uNjB8mK6FHA.736@xxxxxxxxxxxxxxxxxxxxxxx
>> Thanks for the quick responses, Bob. It's greatly appreciated as I try
>> to figure this out.
>>
>> I do have some concerns with using the 8bpp, and even 4bpp (I am willing
>> to test, but what is the best way to compress?).
>>
>> Ideally I could use the 1bpp and somehow test the Bitmap for an abundance
>> of black, and if true, invert the image. Are there any image histograms
>> available in GDI+? Or, should I just read every pixel in and determine
>> the condition that way? Being new to GDI+, and imaging in general, I
>> want to make sure I do not write any unnecessary, resource-sucking code.
>>
>> Any and all suggestions are welcome. Thanks in advance.
>>
>> -Peter van der Maas
>>
>>
>> "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:eo8agCK6FHA.808@xxxxxxxxxxxxxxxxxxxxxxx
>>> CCITT compression only works on the 1bpp images.
>>>
>>> I have never seen a 1 bpp image with the levels swapped.
>>>
>>> I don't know of a way to use 4 or 8 bpp images in this application. I
>>> would imagine 8 bpp images would get towards the limit of sensible
>>> memory consumption.
>>>
>>> --
>>> Bob Powell [MVP]
>>> Visual C#, System.Drawing
>>>
>>> Ramuseco Limited .NET consulting
>>> http://www.ramuseco.com
>>>
>>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>>> http://www.bobpowell.net/tipstricks.htm
>>>
>>> Answer those GDI+ questions with the GDI+ FAQ
>>> http://www.bobpowell.net/faqmain.htm
>>>
>>> All new articles provide code in C# and VB.NET.
>>> Subscribe to the RSS feeds provided and never miss a new article.
>>>
>>>
>>>
>>>
>>>
>>> "Peter van der Maas" <pjvander@xxxxxxxxx> wrote in message
>>> news:uf3Xs9J6FHA.3636@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Doesn't CCITT only work on 1bpp? Or, can I get it to compress 4/8bpp
>>>> images?
>>>>
>>>> Problem with the 1bpp is that sometimes they come through inverted if
>>>> the scanner does not send expected photometric interpretation.
>>>>
>>>>
>>>> "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>>>> news:%23D$ld2J6FHA.2676@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> Does the CCITT compression not work for this kind of image?
>>>>>
>>>>> I would imagine that it does but unfortunately I don't have a scanner
>>>>> that delivers this type of image or I would test it.
>>>>>
>>>>> --
>>>>> Bob Powell [MVP]
>>>>> Visual C#, System.Drawing
>>>>>
>>>>> Ramuseco Limited .NET consulting
>>>>> http://www.ramuseco.com
>>>>>
>>>>> Find great Windows Forms articles in Windows Forms Tips and Tricks
>>>>> http://www.bobpowell.net/tipstricks.htm
>>>>>
>>>>> Answer those GDI+ questions with the GDI+ FAQ
>>>>> http://www.bobpowell.net/faqmain.htm
>>>>>
>>>>> All new articles provide code in C# and VB.NET.
>>>>> Subscribe to the RSS feeds provided and never miss a new article.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> "Peter van der Maas" <pjvander@xxxxxxxxx> wrote in message
>>>>> news:OqlB05G6FHA.2552@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>> Currently using C#/.NET to communicate with a scanner via a TWAIN
>>>>>> library (dotTwain). Library returns a Bitmap that I would like to
>>>>>> compress as a Tiff for storage in a DB. Here is my dilemma:
>>>>>>
>>>>>> -If I use bitonal images, e.g. 1bpp, the TWAIN drivers of certain
>>>>>> devices sets the photometric interpretation tag to an unexpected
>>>>>> value (I believe MinIsWhite). I end up with black page with white
>>>>>> writing on these devices. What is the best way to test for this
>>>>>> condition so I can handles these images properly? (this method has
>>>>>> value to me because of the CCITT compression available for 1bpp).
>>>>>>
>>>>>> OR
>>>>>>
>>>>>> -I would like to be able to change the Bitmap's BitDepth to something
>>>>>> such as 4bpp (is this possible?). Also, if this is a possible
>>>>>> solution, what types of compression are supported for 4bpp (or even
>>>>>> 8bpp if that is my only option)?
>>>>>>
>>>>>> My overall goal is to get these images as small as possble (file
>>>>>> size) while remining some hint of quality without having to reinvent
>>>>>> the wheel.
>>>>>>
>>>>>> Any suggestions? What have others done in this type of situation?
>>>>>>
>>>>>> Thanks in advance for any input.
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: vb.net Multipage TIFF
    ... Bob, I also contacted Michael through your US number in hopes of maybe ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... I had no idea that converting text to tiff was such a big ordeal. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Panel with double buffer
    ... Bob, I think that is the definition. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... Public Sub New ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Reduce image file size without losing visible quality
    ... Sorry Bob. ... See the GDI+ FAQ. ... > Find great Windows Forms articles in Windows Forms Tips and Tricks ... >> Private Function GetReducedImage(ByRef image As Bitmap) As Bitmap ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Changing dpi
    ... Thanks Bob! ... > Find great Windows Forms articles in Windows Forms Tips and Tricks ... > Answer those GDI+ questions with the GDI+ FAQ ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Printing graphics/text that span multiple pages
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... You need to figure out how many pages you need and then render your ...
    (microsoft.public.dotnet.framework.drawing)