Sub Main() Dim TIFF_TAG_COMPRESSION As Integer = 259 Dim Image_Org As Image = Bitmap.FromFile("Original.tif") Dim PropItem As PropertyItem = Image_Org.GetPropertyItem(TIFF_TAG_COMPRESSION) Dim Comp As EncoderValue = PropItem.Value(0) Dim Fd_FrameDimension As FrameDimension = New FrameDimension(Image_Org.FrameDimensionsList(0)) Dim Image_Page As Integer = Image_Org.GetFrameCount(Fd_FrameDimension) Dim Image_Save(Image_Page - 1) As Image For In_Idx As Integer = 0 To Image_Page - 1 Image_Org.SelectActiveFrame(Fd_FrameDimension, In_Idx) Image_Save(In_Idx) = CType(Image_Org.Clone(), Image) Next Call SaveMultiTiff( "Save.tif",Image_Save, Comp) End Sub 以上になります。
日研迷琉 2024/06/10 (Mon) 18:16:29
出来上がったファイルが元データ(4MB)と比較すると約80倍程度大きくなります。
やりたいことは、スキャナでスキャンしたMultiTIFをイメージに読み込み
そのまま、書き出しているだけの処理です。
(書き出しロジックはとりあえず丸パクリです。)
(この先に頁編集等のロジックは追加予定です)
何か考え方が間違っているのでしょうか?
<Windows11>
<VS2022 VB>
コーディングを記載させて頂きます。(参照定義は割愛させて頂きます。)
Sub Main()
Dim TIFF_TAG_COMPRESSION As Integer = 259
Dim Image_Org As Image = Bitmap.FromFile("Original.tif")
Dim PropItem As PropertyItem = Image_Org.GetPropertyItem(TIFF_TAG_COMPRESSION)
Dim Comp As EncoderValue = PropItem.Value(0)
Dim Fd_FrameDimension As FrameDimension = New FrameDimension(Image_Org.FrameDimensionsList(0))
Dim Image_Page As Integer = Image_Org.GetFrameCount(Fd_FrameDimension)
Dim Image_Save(Image_Page - 1) As Image
For In_Idx As Integer = 0 To Image_Page - 1
Image_Org.SelectActiveFrame(Fd_FrameDimension, In_Idx)
Image_Save(In_Idx) = CType(Image_Org.Clone(), Image)
Next
Call SaveMultiTiff( "Save.tif",Image_Save, Comp)
End Sub
以上になります。