473,416 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Need help creating TIF and opening

k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and
made into a TIF file and placed on the client (could be in temp internet
dir). The reason we need it in TIF format is there are multiple pages per
invoice.

How can I grab the data, make the TIF, place it on the client and then Open
with the clients default program for veiwing TIF's (usually Microsoft Picture
and Fax Viewer).

Please help.
Nov 16 '05 #1
4 7376
Hi,

In past lives I've coded custom TIF reader/writer code; multi page 12 bit
gray scale images with custom tag data for each page. I dunno how much
support you've got in .NET for all of the many many things that TIF can do -
so the first thing I'd recommend is figure out exactly what TIF features you
need and see if the .NET framework supports them. Questions:

1) In what format is the SQL BLOB data?

2) In addition to multiple pages what other TIF features do you need?
Compression? Bizarre color depth? Grayscale? Custom data tags?

After a quick scan of MSDN, here are some relevant .NET namespaces and
classes:

System.Drawing
Bitmap
Image
ImageConverter
ImageFormatConverter
System.Drawing.Imaging
ImageFormat

If the .NET framework does NOT support what you need then I would seriousely
consider looking for a third party tool that meets your requirements. I used
one last century, I can't remember what it was, I think it was "Image Gear" -
it was a very good tool with an extrememly simple API, try googling on that...

However, if you find yourself in the situation that I was in --> custom gray
scale bitmap format from a newly developed hardware device, requirement for
code with a tiny footprint that could run embedded on the new device, a need
to store TIF custom data tags, and googling and asking everyone you know and
you still couldn't find a tool or API to do it for you. - then you're
probably going to have to write some TIF code...

If you decide to write your own code then I would STRONGLY recommend that
you write the TIF code from C++. I don't have code with me but I do remember
a few things about TIF format 1) byte order for some TIF headers must be hard
coded to little/big endian format {I forget which}, 2) You will find yourself
defining several header structs and then positioning them at various raw byte
offsets in the file as you read/write data. IMHO these lower level byte
manipulation tasks are better suited for C++; I'm certain that you could do
the work from unsafe C# code but C++ code would probably be more natural to
work with...

lotsa luck...

--Richard

P.S. If you do find yourself needing to write your own code {and I hope you
don't} then there is a book out there - I think it's called "The Encyclopedia
of Graphic File Formats" or something like that, it describes TIF format in
exhausting detail...

"Phil" wrote:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and
made into a TIF file and placed on the client (could be in temp internet
dir). The reason we need it in TIF format is there are multiple pages per
invoice.

How can I grab the data, make the TIF, place it on the client and then Open
with the clients default program for veiwing TIF's (usually Microsoft Picture
and Fax Viewer).

Please help.

Nov 16 '05 #2
Thanks for your advice Richard. I do not need any specific features of the
TIF format, other than displaying multiple pages. Our business users were ok
even with a GIF format, but could not see page 2, 3, 4 .. so on

The code I am using now will pop up the dialog box to Open or Save the file.
But the File format is coming up as ASPX rather than TIF. If I choose save
and change the extension, I can save the file and open it with Picture and
Fax viewer... but it is too many steps for the end user. It would be ideal to
stream this data and have the dialog pop up and either open the Micro P & F
viewer or save it to the client (with the correct extension. Here is the
simple code.

qlConnection myConn = new
SqlConnection(ConfigurationSettings.AppSettings["strConnection"]);
SqlCommand myComm = new SqlCommand("Select SX_Image_Data from
SX_ACCSXDB_Images where chrBarCode = '" + Request.QueryString["invoice"] +
"'",myConn);

myConn.Open();

byte [] img = (byte[]) myComm.ExecuteScalar();
Response.ContentType = "image/tiff";
Response.BinaryWrite(img);

myConn.Close();

Nov 16 '05 #3
I have been developing on a TIFF library for almost a month now.
It seems to turn out good.
We needed native TIFF support for our PDF library because
we need to support other color spaces than RGB, mainly CMYK.
It supports any public or private tags with the same approach as
System.Drawing.Image;
it uses a collection of meta data properties to provide them all.
Even if the tag is not known by the library, it still extracts the tag data
and exposes it for reading and writing.

However, You do not mention anything about additional color spaces other
than RGB.
Therefore, i think the only thing you will need is System.Drawing.Bitmap.
AFAIK, It supports decoding any types of TIFF files compressed with any
algorithm supported
by TIFF, including LZW, JPEG, PackBits and CCITT and decodes in any color
space,
but converts it to RGB.
If you have no problem with using RGB only, just use System.Drawing.Bitmap
to load the image and use the overloaded Save method which also takes an
output format
to specify that you want the TIFF output format.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Richard" <Ri*****@discussions.microsoft.com> wrote in message
news:29**********************************@microsof t.com...
Hi,

In past lives I've coded custom TIF reader/writer code; multi page 12 bit
gray scale images with custom tag data for each page. I dunno how much
support you've got in .NET for all of the many many things that TIF can
do -
so the first thing I'd recommend is figure out exactly what TIF features
you
need and see if the .NET framework supports them. Questions:

1) In what format is the SQL BLOB data?

2) In addition to multiple pages what other TIF features do you need?
Compression? Bizarre color depth? Grayscale? Custom data tags?

After a quick scan of MSDN, here are some relevant .NET namespaces and
classes:

System.Drawing
Bitmap
Image
ImageConverter
ImageFormatConverter
System.Drawing.Imaging
ImageFormat

If the .NET framework does NOT support what you need then I would
seriousely
consider looking for a third party tool that meets your requirements. I
used
one last century, I can't remember what it was, I think it was "Image
Gear" -
it was a very good tool with an extrememly simple API, try googling on
that...

However, if you find yourself in the situation that I was in --> custom
gray
scale bitmap format from a newly developed hardware device, requirement
for
code with a tiny footprint that could run embedded on the new device, a
need
to store TIF custom data tags, and googling and asking everyone you know
and
you still couldn't find a tool or API to do it for you. - then you're
probably going to have to write some TIF code...

If you decide to write your own code then I would STRONGLY recommend that
you write the TIF code from C++. I don't have code with me but I do
remember
a few things about TIF format 1) byte order for some TIF headers must be
hard
coded to little/big endian format {I forget which}, 2) You will find
yourself
defining several header structs and then positioning them at various raw
byte
offsets in the file as you read/write data. IMHO these lower level byte
manipulation tasks are better suited for C++; I'm certain that you could
do
the work from unsafe C# code but C++ code would probably be more natural
to
work with...

lotsa luck...

--Richard

P.S. If you do find yourself needing to write your own code {and I hope
you
don't} then there is a book out there - I think it's called "The
Encyclopedia
of Graphic File Formats" or something like that, it describes TIF format
in
exhausting detail...

"Phil" wrote:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed
and
made into a TIF file and placed on the client (could be in temp internet
dir). The reason we need it in TIF format is there are multiple pages per
invoice.

How can I grab the data, make the TIF, place it on the client and then
Open
with the clients default program for veiwing TIF's (usually Microsoft
Picture
and Fax Viewer).

Please help.

Nov 16 '05 #4
I hope this post isn't too old...

I am working on converting tiff's now as well. My main problem at this
point is that I'm trying to switch the byte order. I get tiff's sent to me
that are intel(little endian) and my system will only work with motorola(big
endian). I am having a hard time finding anything in the .NET framework to
convert this.

Any help would be greatly appreciated.

thanks
dave

"Phil" wrote:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and
made into a TIF file and placed on the client (could be in temp internet
dir). The reason we need it in TIF format is there are multiple pages per
invoice.

How can I grab the data, make the TIF, place it on the client and then Open
with the clients default program for veiwing TIF's (usually Microsoft Picture
and Fax Viewer).

Please help.

Nov 16 '05 #5

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

Similar topics

4
by: gonzal | last post by:
Hi Dose any body know why a temporary table gets deleted after querying it the first time (using SELECT INTO)? When I run the code bellow I'm getting an error message when open the temp table...
5
by: Ken Varn | last post by:
I have a named mutex object that is accessed by both an asp.net application and a Windows executable .net application. The Windows executable runs under the administrator logon, while the asp.net...
0
by: SQLReporter | last post by:
Hi, I am getting following error when opening/creating web projects in VS.NET... --------------------------- Microsoft Development Environment --------------------------- The Web server...
1
by: Jarrod Hyder | last post by:
Ok, I wrote my own weblog and I'm working on the web interface for adding/editing my posts. I decided to add a little preview button...when the button is clicked it is suppose to open a pop-up...
7
by: Susan Bricker | last post by:
Greetings. As a relative newcomer to Access, I am having trouble deciding on how to design the form flow for updating and creating related records. I'm looking for a variety of suggestions so...
7
by: pillip | last post by:
I am trying to use fopen and fget to input two files and then output them into one file. Each input file has two columns and 20 rows, however since the first column in each input file is same (...
7
by: fox | last post by:
Hi, Lacking javascript knowledge, I just realized why my project has a bug. I am using ASP to loop through a set of records while it creates URLs with a querystring that has a single value pair....
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
2
bmallett
by: bmallett | last post by:
I am getting the following error: Error Type: ADODB.Command (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
0
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...

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.