473,786 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with large tiff files

I have large 1bpp tiff scans of arch. drawings that are typically 12032x16890
pixels (filesize is about a 1 meg +/-)

While I can readily view smaller (dimension) files, when I try to do
anything after loading

I've looked at most of the samples on the web in using GDI+... they all fall
over dead with these large files.

Any help is appreciated.


Jan 14 '08 #1
3 2949
On Sun, 13 Jan 2008 21:35:00 -0800, tkiehl
<tk****@discuss ions.microsoft. comwrote:
I have large 1bpp tiff scans of arch. drawings that are typically
12032x16890
pixels (filesize is about a 1 meg +/-)

While I can readily view smaller (dimension) files, when I try to do
anything after loading
Did you mean to complete that thought?
I've looked at most of the samples on the web in using GDI+... they all
fall
over dead with these large files.
It sounds as though even though the files are monochrome, when .NET tries
to load them it's trying to make a full-color image. And of course
12Kx17K at 24bpp is pretty huge. I'm not aware of any way to control the
internal format of an Image instance initialized from a file. You may
have to handle the loading yourself, by creating an appropriate 1 bpp
monochrome Bitmap instance, using LockBits to get the buffer, and read the
file data in explicitly, copying to the image's buffer.

Pete
Jan 14 '08 #2
Pete,

In my current (working) version of the app, I'm using straight GDI and a
third party library to initally read in the file, then I move/scale it over
dibsections and all is good.

I'd like to use the gdi+ and get rid of the 3rd party library.

Problem is, I can't get at the bits because (it appears to be as you say)
the gdi+ bitmap has already "done something to them". If I could get to the
bits, I'd be a happy camper, but I think I need to first get the handle to
the GDI bitmap with the GDI+ call Bitmap.GetHBITM AP which fails on the big
files (I could be wrong here).

I have a sample that uses the GDI+ Image, but each time it wants to draw
onto the graphics, it takes way too long since it appears to have to decode
+all+ the bits each time it draws. With my straight GDI version, once the
file is loaded and handed off to my dibsections it is fast with BitBlt and
StretchBlt.

TK

"Peter Duniho" wrote:
On Sun, 13 Jan 2008 21:35:00 -0800, tkiehl
<tk****@discuss ions.microsoft. comwrote:
I have large 1bpp tiff scans of arch. drawings that are typically
12032x16890
pixels (filesize is about a 1 meg +/-)

While I can readily view smaller (dimension) files, when I try to do
anything after loading

Did you mean to complete that thought?
I've looked at most of the samples on the web in using GDI+... they all
fall
over dead with these large files.

It sounds as though even though the files are monochrome, when .NET tries
to load them it's trying to make a full-color image. And of course
12Kx17K at 24bpp is pretty huge. I'm not aware of any way to control the
internal format of an Image instance initialized from a file. You may
have to handle the loading yourself, by creating an appropriate 1 bpp
monochrome Bitmap instance, using LockBits to get the buffer, and read the
file data in explicitly, copying to the image's buffer.

Pete
Jan 14 '08 #3
On Mon, 14 Jan 2008 00:14:00 -0800, tkiehl
<tk****@discuss ions.microsoft. comwrote:
In my current (working) version of the app, I'm using straight GDI and a
third party library to initally read in the file, then I move/scale it
over
dibsections and all is good.

I'd like to use the gdi+ and get rid of the 3rd party library.
But the 3rd party library is providing functionality that .NET doesn't
offer.
Problem is, I can't get at the bits because (it appears to be as you say)
the gdi+ bitmap has already "done something to them".
I didn't say the bitmap has already "done something to them". I said that
..NET is creating a full-color bitmap even though the file is monochrome.
If I could get to the
bits, I'd be a happy camper, but I think I need to first get the handle
to
the GDI bitmap with the GDI+ call Bitmap.GetHBITM AP which fails on the
big
files (I could be wrong here).
I think you are wrong. The monochrome bits are likely never in the
bitmap. .NET is likely reading the data straight from the file and
converting it immediately before putting it into the bitmap.

You will need to "get to the bits" by reading the file yourself. This
would essentially involve rewriting the functionality of your 3rd party
library. The TIFF file format is not complicated, and this would not be
difficult to do, but you might want to consider just using the 3rd party
library via p/invoke to deliver a monochrome HBITMAP that you can use to
initialize a .NET Bitmap instance.

You'll still have the dependency on the 3rd party library, but it will be
less effort than reading the file yourself.

This assumes that .NET will just wrap the HBITMAP rather than doing
something to convert it. I suspect that's the case, but if not then
you'll have to copy it into a Bitmap instance you've explicitly created to
be monochrome, again using p/invoke (get the DC from your new Bitmap and
use unmanaged GDI to draw the HBITMAP into the new Bitmap using the DC).

After all is said and done, you may find yourself wishing that you'd just
taken the time to learn the TIFF file format and import the bits directly
that way. :)
I have a sample that uses the GDI+ Image, but each time it wants to draw
onto the graphics, it takes way too long since it appears to have to
decode
+all+ the bits each time it draws. With my straight GDI version, once the
file is loaded and handed off to my dibsections it is fast with BitBlt
and
StretchBlt.
I doubt that the time is being spent "decoding" anything. By my
calculations, a 24bpp image the size you're talking about is roughly
600MB. It's likely that the time is simply all of that data being moved
back and forth to and from the swap file as it's needed. My guess is that
if you look at the disk activity while you're waiting for the bitmap to
draw, you'll notice significant activity.

Pete
Jan 14 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3789
by: frankenberry | last post by:
I have multi-page tiff files. I need to extract individual frames from the multi-page tiffs and save them as single-page tiffs. 95% of the time I receive multi-page tiffs containing 1 or more black and white CCITT4 compressed files (frames) inside the tiff. Every now and then I receive a mixture of black and white CCITT4 and JPEG compressed files, and sometimes just multi-page tiffs with JPEG only. The code runs great when dealing with the...
1
3966
by: ashish | last post by:
We are working on development of an IFilter component for Jpeg and tiff files.First ever test resulted in following error. We are using ifilttst.exe(which comes with windows 2003 resource kit.) to test the filter. Source code snippet has been attached at the end of message. We are stuck at this point for the last 5 days and still unable to resolve it. 380.396 : +TEST+INFO **** Input file : C:\Program Files\Windows Resource...
0
2013
by: Will Arrowsmith | last post by:
Hi All, I am trying to create a .tiff file to fax using the windows fax service FAXCOMLib. I have created an array of images (bitmaps) and converted them to 1pbb format in order to allow CCITT3/4 compression for faxing. The .Tiff file appears to be created successfully however when I try to send the file as a fax I get the error: System.Runtime.InteropServices.COMException (0x8007000D): The data is
3
2085
by: Brad | last post by:
I'm working on a web app which will display LARGE tiff image files (e.g files 10-20+ mb). Files are hidden from users direct access. For other, smaller image files I have used FileStream to read in a file in a single Read and so my quesitons are: (1) What is a practical file size limit for reading using FileStream.Read (reading the file in a single read)...especially on a web server where I don't think I'd want to tax memory...
1
4601
by: Bala | last post by:
Hi I try to download the tiff files from my server. Its get downloaded but I cannot open with windows fax viewer. its says "No preview available" thanks bala here is the code which I am using
5
15016
by: Sameer Gupta | last post by:
what are options for opening / handling tiff files in .Net framework ? which is the best library, namespace ? Please help Regards Sameer Gupta C# Designer & Developer Siemens UK
7
3794
by: Ben | last post by:
Hi We are looking for a component that offers that offers the below for Tiff files: Image clean-up (deskew, despeckle) Printing capabilities from VB The ability to add text to image, e.g. time / date Nice to have:
4
13177
by: G E W hittle | last post by:
I have a directory of tiff files. I need to loop thru the files and count the number of pages in each file. Can someone point me to where this info is stored? GW
3
7528
by: GiJeet | last post by:
Hello, we have an app that scans documents into TIFF format and we need to transfer them over the internet. If anyone knows of a SDK we can use that can compress TIFFs on the fly or even if it can compress them so they take up less space on the server, would be appreciated. Actually any info on handling tiff files programatically would be appreciated as I know very little about tiffs. TIA
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8992
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.