Merging A5 to A4

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
Post Reply
BennyLap
Posts: 8
Joined: Wed Oct 26, 2011 5:02 am

Merging A5 to A4

Post by BennyLap » Mon Sep 10, 2012 7:20 am

I'm scanning duplex A5 papers and want to merge the A5 tiffs to A4..
any method to do so?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Merging A5 to A4

Post by Loïc » Mon Sep 10, 2012 6:58 pm

Hello,

You can create an empty image by using the CreateNewGdPictureImage() method and subsequently draw over it your images by using the one of the DrawGdPictureImage() methods.

Kind regards,

Loïc

BennyLap
Posts: 8
Joined: Wed Oct 26, 2011 5:02 am

Re: Merging A5 to A4

Post by BennyLap » Wed Sep 12, 2012 1:25 pm

Hi,

I have tried to use the CreateNewGdPictureImage method and also the DrawGdPictureImage method to do so.
But the output image's bit depth is 24 when my input images' bit depth are 1 only. Hence the filesize of the output is very large and it lower my performance.

Here are my codes:

Code: Select all

Dim ImageID = _gimg.CreateGdPictureImageFromFile("image1.tif")
        Dim ImageID2 = _gimg.CreateGdPictureImageFromFile("image2.tif")
        Dim width = _gimg.GetWidth(ImageID) * 2
        Dim height = _gimg.GetHeight(ImageID)

        Dim ResImg = _gimg.CreateNewGdPictureImage(width, height, CType(_gimg.GetBitDepth(ImageID), Short), Color.White)
        _gimg.SetHorizontalResolution(ResImg, 300)
        _gimg.SetVerticalResolution(ResImg, 300)
        MsgBox(_gimg.GetBitDepth(ResImg))
        _gimg.DrawGdPictureImage(ImageID, ResImg, 0, 0, _gimg.GetWidth(ImageID), _gimg.GetHeight(ImageID), Drawing2D.InterpolationMode.High)
        _gimg.DrawGdPictureImage(ImageID2, ResImg, _gimg.GetWidth(ImageID), 0, _gimg.GetWidth(ImageID2), _gimg.GetHeight(ImageID2), Drawing2D.InterpolationMode.High)

        MsgBox(_gimg.GetBitDepth(ResImg))

        If _gimg.GetBitDepth(ImageID) > 2 Or _gimg.GetBitDepth(ImageID2) > 2 Then
            _gimg.SaveAsTIFF(ResImg, "out.tif", GdPicture.TiffCompression.TiffCompressionJPEG, 90)
        Else
            _gimg.SaveAsTIFF(ResImg, "out.tif", GdPicture.TiffCompression.TiffCompressionCCITT4)
        End If

        _gimg.ReleaseGdPictureImage(ImageID)
        _gimg.ReleaseGdPictureImage(ImageID2)
        _gimg.ReleaseGdPictureImage(ResImg)

Can you give me some advice to do what i want?

Thanks a lot
Benny

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Merging A5 to A4

Post by Loïc » Wed Sep 12, 2012 3:45 pm

Hello Benny,

Just convert it to 1bpp by using the ConvertTo1Bpp() method when you are done with your drawing operations.

Kind regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests