Loading...

Does gdpicture support multiple tif?

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Does gdpicture support multiple tif?

Postby mabdullah » Tue Jan 25, 2011 1:31 pm

I am currently evaluate your product & support so i am new to your product and my question is:
Does gdpicture (SaveAsByteArray & CreateImageFromBy) support multiple tif file?

because up on the below code, it saves only the first page of the multiple tif file, help plz?

1- load multiple tif file from desk
Code: Select all
CloseImage
   Call Imaging1.CreateImageFromFile(App.Path & "\output.tif")
      If Imaging1.GetStat = 0 Then
         Call ShowBitmap
      End If
   GdViewer1.SetNativeImage (Imaging1.GetNativeImage)
   GdViewer1.ZoomMode = ZoomFitToControl
   txtFormat.Text = Imaging1.GetImageFormat
   


2- save the tif file to database
Code: Select all
'append the native image of an Imaging object to the OLE field
 Dim arBytes() As Byte
   Call Imaging1.SaveAsByteArray(arBytes, 0, "tif")             
    With rs              'recordset
        .Fields("ImageData").AppendChunk (arBytes())
        .Update
        MsgBox "Saved"
    End With
    Erase arBytes


3- read image from database
Code: Select all
'---read image from database
Dim arbyte() As Byte
arbyte = rs.Fields("ImageData").GetChunk(LenB(rs.Fields("ImageData")))     'get image & store in byte
Call Imaging1.CreateImageFromByteArray(arbyte)         'display image in viewer
If Imaging1.GetStat <> 0 Then
      MsgBox "There is no bitmap in the byte array"
Else
    Call ShowBitmap
    ShowBitmapProperties
End If
Erase arbyte
rs.Close
mabdullah
 
Posts: 18
Joined: Sun Jan 16, 2011 11:44 am

Re: Does gdpicture support multiple tif?

Postby Loïc » Tue Jan 25, 2011 8:17 pm

Hi,

SaveAsByteArray supports only single page writing.
A workaround consists to save to multipage tiff to a file, then read the file in an array of bytes. or use GdPicture.NET if you are developing with the .NET plateform.

Kind regards,

Loïc

Note: Let me know if you need a snippet for the workaround.
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Does gdpicture support multiple tif?

Postby mabdullah » Tue Jan 25, 2011 9:45 pm

Loïc wrote:Note: Let me know if you need a snippet for the workaround.



yes please, Loïc i want the snippet code for the workaround for both SaveAsByteArray & CreateImageFromByteArray.
mabdullah
 
Posts: 18
Joined: Sun Jan 16, 2011 11:44 am

Re: Does gdpicture support multiple tif?

Postby Loïc » Thu Jan 27, 2011 6:21 pm

Hi,

Here the snippet:


Code: Select all
Dim ImageID As Long
Dim bytes() As Byte
Dim file_length As Long
Dim fnum As Integer
Dim tmp_file As String
   
   
tmp_file = "tmp.tmp" 'Todo: change the path
Imaging1.TiffOpenMultiPageAsReadOnly (False)
Call Imaging1.CreateImageFromFile("c:\multipage.tif")
ImageID = Imaging1.GetNativeImage
Call Imaging1.TiffSwapPages(ImageID, 1, 2)
Call Imaging1.TiffSaveMultiPageToFile(ImageID, tmp_file, CompressionCCITT4)
Imaging1.CloseImage (ImageID)

'Now loading the tmp file in an array of byte
file_length = FileLen(tmp_file)
fnum = FreeFile
ReDim bytes(1 To file_length)
Open tmp_file For Binary As #fnum
Get #fnum, 1, bytes
Close fnum
Kill tmp_file


Hope this helps.

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest

cron