I was successful in creating the multipage Tif files in VB.net using
the following the following code:
Public Sub SaveSeveralOnePageFilesInADir(ByVal DrNm As String, ByVal
resultFl As String)
Dim pages As Bitmap = Nothing
Dim PgCnt As Integer
Dim ix As Integer
Dim fl As String
If Dir$(resultFl) <> "" Then
Kill(resultFl)
End If
'---------------------------------
Dim enc As System.Drawing.Imaging.Encoder =
System.Drawing.Imaging.Encoder.SaveFlag
Dim info As System.Drawing.Imaging.ImageCodecInfo =
Nothing
For Each ice As System.Drawing.Imaging.ImageCodecInfo In
System.Drawing.Imaging.ImageCodecInfo.GetImageEnco ders
If ice.MimeType = "image/tiff" Then
info = ice
End If
Next
Dim ep As System.Drawing.Imaging.EncoderParameters =
New System.Drawing.Imaging.EncoderParameters(1)
fl = Dir$(DrNm + "\*.*", FileAttribute.Normal +
FileAttribute.Archive)
ix = 0
Do While fl <> ""
fl = UCase$(fl)
If InStr(fl, ".JPG") <> 0 Or InStr(fl, ".GIF") <> 0 Then
ix = ix + 1
fl = DrNm + "\" + fl
If ix = 1 Then
ep.Param(0) = New
System.Drawing.Imaging.EncoderParameter(enc,
CType(System.Drawing.Imaging.EncoderValue.MultiFra me, Long))
pages = Image.FromFile(fl)
pages.Save(resultFl, info, ep)
Else
ep.Param(0) = New
System.Drawing.Imaging.EncoderParameter(enc,
CType(System.Drawing.Imaging.EncoderValue.FrameDim ensionPage, Long))
Dim bm As Bitmap = Image.FromFile(fl)
pages.SaveAdd(bm, ep)
End If
End If
fl = Dir$()
Loop
ep.Param(0) = New
System.Drawing.Imaging.EncoderParameter(enc,
CType(System.Drawing.Imaging.EncoderValue.Flush, Long))
pages.SaveAdd(ep)
End Sub
My big problem now is that I was not able to find information on how I
can
also set the compression that I need for the pages of those multipage
Tif
files. For example, for the black and white images in a multipage Tiff
file,
the compression should be CCITT4, and, for the color images in a
multipage
Tif file, the compression should be JPEG medium compression with the
medium
resolution. How can it be accomplished?
Thank you very much.
Irene S. 1 4866
Hi, http://www.bobpowell.net/generating_multipage_tiffs.htm
Ken
------------
"Ira" <ir*****@ifat.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com... I was successful in creating the multipage Tif files in VB.net using the following the following code:
Public Sub SaveSeveralOnePageFilesInADir(ByVal DrNm As String, ByVal
resultFl As String)
Dim pages As Bitmap = Nothing Dim PgCnt As Integer Dim ix As Integer
Dim fl As String
If Dir$(resultFl) <> "" Then Kill(resultFl) End If
'---------------------------------
Dim enc As System.Drawing.Imaging.Encoder = System.Drawing.Imaging.Encoder.SaveFlag
Dim info As System.Drawing.Imaging.ImageCodecInfo = Nothing
For Each ice As System.Drawing.Imaging.ImageCodecInfo In System.Drawing.Imaging.ImageCodecInfo.GetImageEnco ders
If ice.MimeType = "image/tiff" Then
info = ice
End If
Next
Dim ep As System.Drawing.Imaging.EncoderParameters = New System.Drawing.Imaging.EncoderParameters(1)
fl = Dir$(DrNm + "\*.*", FileAttribute.Normal + FileAttribute.Archive) ix = 0 Do While fl <> "" fl = UCase$(fl) If InStr(fl, ".JPG") <> 0 Or InStr(fl, ".GIF") <> 0 Then ix = ix + 1 fl = DrNm + "\" + fl If ix = 1 Then
ep.Param(0) = New System.Drawing.Imaging.EncoderParameter(enc, CType(System.Drawing.Imaging.EncoderValue.MultiFra me, Long))
pages = Image.FromFile(fl) pages.Save(resultFl, info, ep) Else ep.Param(0) = New System.Drawing.Imaging.EncoderParameter(enc, CType(System.Drawing.Imaging.EncoderValue.FrameDim ensionPage, Long))
Dim bm As Bitmap = Image.FromFile(fl) pages.SaveAdd(bm, ep) End If End If fl = Dir$() Loop
ep.Param(0) = New System.Drawing.Imaging.EncoderParameter(enc, CType(System.Drawing.Imaging.EncoderValue.Flush, Long))
pages.SaveAdd(ep)
End Sub
My big problem now is that I was not able to find information on how I can also set the compression that I need for the pages of those multipage Tif files. For example, for the black and white images in a multipage Tiff file, the compression should be CCITT4, and, for the color images in a multipage Tif file, the compression should be JPEG medium compression with the medium resolution. How can it be accomplished?
Thank you very much.
Irene S. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: news.microsoft.com |
last post by:
Hello group,
My goal is to attach an image over another image.
Top image should be transparent so the back image is visible through the top
one.
Bellow is a test code in VB.NET. You need to...
|
by: Maurice Mertens |
last post by:
Hello,
I'm having troubles with saving a tiff-file with a certain compression
and colordepth. This is the code I use:
----------------------------------------------------------------------...
|
by: Phin |
last post by:
Hi,
I have spent some time trying to get the tabstrip and multipage to work
(from the IE web controls).
I read the article from:...
|
by: chris.atlee |
last post by:
I'm writing a program in python that creates tar files of a certain
maximum size (to fit onto CD/DVD). One of the problems I'm running
into is that when using compression, it's pretty much...
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting"...
|
by: Benny Ng |
last post by:
Dear All,
Now I met some performance problems in my application. Because according
to our business. The size of some web forms are larger than 1xxx MB. So it
takes a long time for user opening a...
|
by: pamela fluente |
last post by:
I have been using something like:
public void SaveJPG(Image Image, string FileName, long
QualityLevel_0_100, long ColorDepthLevel)
{
ImageCodecInfo ImageCodecInfoJPG =...
|
by: helveticus |
last post by:
I'm having difficulties setting the expires header for images and css
files in my compression HttpModule. Compression is carried out by
context_BeginRequest and works fine (code not shown)....
|
by: Jon Harrop |
last post by:
I just added save-to-PNG to our software and noticed that WPF generates
enormous PNG files. Re-encoding them under Linux makes them 20x smaller.
Is it possible to enable compression under .NET or...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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...
|
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...
|
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,...
|
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,...
| |