Loading...

TIFF Rotate and Save

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

TIFF Rotate and Save

Postby kviral » Fri Nov 27, 2009 11:12 am

Hi Loic,

I am loading a Multipage TIFF file in GDViewwer Pro, and rotate one of its page, and when i am trying to save thru
Code: Select all
Call Imaging1.SaveAsTIFF(CurrentLoadedFile, CompressionCCITT4)
,
it saves only a page (without rotation) of a file rather than all pages along with rotated one.

Following is my code snippet:
Loading for TIFF
Code: Select all
                Call Imaging1.CreateImageFromFile(PDFFile) ' SHOWING NON-PDF FILE
                'Call Imaging1.TiffCreateMultiPageFromFile(PDFFile)
                CurrentLoadedFile = PDFFile
                GdViewer1.SetNativeImage (Imaging1.GetNativeImage)
                Call LoadThumbnail(PDFFile)  'CREATING THUMBNAIL
                GdViewer1.Refresh
                showStatus ("File Loaded" & Space(25) & GdViewer1.PageCount & " Pages")


Rotation:

Code: Select all
            DoEvents
            'IF FILE IS TIFF
            CurrentLoadedFile = App.Path & "\Tmpfiles\Temp.tif"
            Call Imaging1.SaveAsTIFF(CurrentLoadedFile, CompressionCCITT4)
Thank you,

Viral Kothari
Software Eng.
Image
User avatar
kviral
 
Posts: 54
Joined: Thu Oct 01, 2009 3:53 pm
Location: Tarrytown, NY

Re: TIFF Rotate and Save

Postby Loïc » Sun Nov 29, 2009 6:34 pm

Hi,

The SaveAsTIFF() method is designed to save a single page tiff image. If you want to save a multipage image in memory please use the TiffSaveMultipageToFile() method.

Kind regards,

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

Re: TIFF Rotate and Save

Postby mdsweb » Sun Oct 17, 2010 1:52 am

Kindly assist as I am having a similar issue.

When I save using SaveAsTiff() method, it only saves 1 page (as expected), but that page is properly rotated.

When I save using TiffSaveMultiPageToFile method, the page saves but is not rotated.

I am trying to overwrite the original file with the rotated image.

Thank you in advance.

Code: Select all
     public static void RotateImage(string path, BarcodeDirection direction)
        {
            GdPictureImaging oGdPictureImaging = new GdPictureImaging();

            //oGdPictureImaging.TiffOpenMultiPageForWrite(false);
            int m_ImageID = oGdPictureImaging.TiffCreateMultiPageFromFile(path);
           
            switch (direction)
            {
                case BarcodeDirection.BottomToTop:
                    oGdPictureImaging.Rotate(m_ImageID, RotateFlipType.Rotate90FlipNone);
                    break;

                case BarcodeDirection.RightToLeft:
                    oGdPictureImaging.Rotate(m_ImageID, RotateFlipType.Rotate180FlipNone);
                    break;

                case BarcodeDirection.TopToBottom:
                    oGdPictureImaging.Rotate(m_ImageID, RotateFlipType.Rotate270FlipNone);
                    break;
            }
       
            oGdPictureImaging.TiffSaveMultiPageToFile(m_ImageID, @"c:\temp\new.tif", TiffCompression.TiffCompressionAUTO);
            //oGdPictureImaging.TiffSaveMultiPageToFile(m_ImageID, path, TiffCompression.TiffCompressionCCITT4, 100);
            oGdPictureImaging.ReleaseGdPictureImage(m_ImageID);
        }
mdsweb
 
Posts: 9
Joined: Wed Jun 23, 2010 5:51 pm

Re: TIFF Rotate and Save

Postby mdsweb » Sun Oct 17, 2010 2:08 am

To perform the above operation, you must enumerate set the current page of the tiff document for each page, and Rotate() each page individually.

Hope this helps someone.
mdsweb
 
Posts: 9
Joined: Wed Jun 23, 2010 5:51 pm

Re: TIFF Rotate and Save

Postby mdsweb » Sun Oct 17, 2010 3:09 am

Actually, I think a bug might exist here for 7.1

I have found that when I Rotate pages by incrementing up -- the last page does not get processed... but this problem does not happen incrementing down. as shown below:
Code: Select all

  public static void RotateImage(string path, BarcodeDirection direction)
        {
            GdPictureImaging oGdPictureImaging = new GdPictureImaging();

            oGdPictureImaging.TiffOpenMultiPageForWrite(true);
            int m_ImageID = oGdPictureImaging.TiffCreateMultiPageFromFile(path);

            for (int i = oGdPictureImaging.TiffGetPageCount(m_ImageID); i > 0 ; i--)  // +1 accounts for deleted page
            {
                oGdPictureImaging.TiffSelectPage(m_ImageID, i);
                switch (direction)
                {
                    case BarcodeDirection.BottomToTop:
                        oGdPictureImaging.Rotate(m_ImageID, RotateFlipType.Rotate90FlipNone);
                        break;

                    case BarcodeDirection.RightToLeft:
                        oGdPictureImaging.Rotate(m_ImageID, RotateFlipType.Rotate180FlipNone);
                        break;

                    case BarcodeDirection.TopToBottom:
                        oGdPictureImaging.Rotate(m_ImageID, RotateFlipType.Rotate270FlipNone);
                        break;
                }

            }
            //oGdPictureImaging.SaveAsTIFF(m_ImageID, path, TiffCompression.TiffCompressionNONE, 80);
           
            oGdPictureImaging.TiffSaveMultiPageToFile(m_ImageID, path, TiffCompression.TiffCompressionCCITT4, 100);
            oGdPictureImaging.ReleaseGdPictureImage(m_ImageID);
        }
mdsweb
 
Posts: 9
Joined: Wed Jun 23, 2010 5:51 pm

Re: TIFF Rotate and Save

Postby Loïc » Mon Oct 18, 2010 6:19 pm

Hi,

I do not understand the new issue :(. Please note you are talking about the .NET version, so the Dotnet section should be more appropriated :wink:

See: dotnet-editions/

Kind regards,

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

Re: TIFF Rotate and Save

Postby mdsweb » Tue Oct 19, 2010 2:53 pm

My apologies, This is for the .NET GdImaging library

I am reporting that when I attempt to rotate each individual page of a multipage tif image, the last page does NOT get rotated... UNLESS I start at the last page, and rotate in reverse order to the first page. As long as I start at the last page, rotate, and then increment down to the first page.... it works fine.

Can you please test this on your end?
mdsweb
 
Posts: 9
Joined: Wed Jun 23, 2010 5:51 pm

Re: TIFF Rotate and Save

Postby Loïc » Tue Oct 19, 2010 2:56 pm

I already made the test it is working fine.
Please give us a way to reproduce the issue for investigation.

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


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: Bing [Bot] and 1 guest