By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,584 Members | 3,447 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,584 IT Pros & Developers. It's quick & easy.

Need help creating TIF and opening

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.