Home | About us | Overview | Software - Download | Evaluate | Order | Support | Contact | F.A.Q. | Documentations | Blog | Newsletter
Loading...

Rotate & delete a frame of a multipage tif image

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

Rotate & delete a frame of a multipage tif image

Postby Andy Trezise » Wed Nov 07, 2007 10:12 pm

How can I save an image (multipage tiff) after one of the pages has been rotated? I am using the GDViewer ocx in foxpro.

eg:

ThisForm.oGdViewer.DisplayFromFile("myfile.tif")

*** my file has five pages

ThisForm.oGdViewer.DisplayLastFrame()

ThisForm.oGdViewer.Rotate90()

I now want to save the file with the last page rotated.

Similarly I would also like to delete one of the pages out of my document.

Can this be done?
Andy Trezise
 
Posts: 10
Joined: Wed Nov 07, 2007 1:39 am

Postby Loïc » Thu Nov 08, 2007 11:43 am

Hi,

The GdViewer can't write file.
If you want to create/edit image files you need to use the Imaging classe of the GdPicture Light or of the GdPicture Pro SDK.

Regards,

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

Saveing a multi page tiff

Postby Andy Trezise » Thu Nov 08, 2007 12:16 pm

So could you explain how to (for example) open a m/p tiff file - lets say it has 5 pages - rotate the 2nd page 180 degrees, delete the third page and then save the new file.

Thanks for your help in advance.
Andy Trezise
 
Posts: 10
Joined: Wed Nov 07, 2007 1:39 am

Postby Loïc » Thu Nov 08, 2007 4:55 pm

Ok:

First Step: Extract all the pages into temporary image files.
Code: Select all
Imaging1.CreateImageFromFile sMultiPageTiffPath

nImageID = Imaging1.CreateImageFromFile("inputmultipage.tif")
nPageCount = Imaging1.TiffGetPageCount
 
For nCpt = 1 To nPageCount
     Imaging1.TiffSelectPage (nCpt)
     Imaging1.SaveAsTiff (Str(nCpt) & ".tif")
Next nCpt

Imaging1.CloseNativeImage



Second step: Recompose new multi page tif file from the desired temporary files and apply processing into desired page.

Code: Select all
nImageID = Imaging1.CreateImageFromFile("1.tif")
Imaging1.TiffSaveAsNativeMultiPage ("outputmultipage.tif")
 
For nCpt = 2 To nPageCount
    If nCpt <> 3 Then
       nImageID = Imaging1.CreateImageFromFile(str(nCpt) & ".tif")
       If nCpt = 2 Then
          Call Imaging1.Rotate (Rotate180FlipNone)
       End If
       Imaging1.TiffAddToNativeMultipage (nImageID)
       Imaging1.CloseImage (nImageID)
   End If
Next nCpt


Imaging1.TiffCloseNativeMultiPage



Regards,

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

Image Manipulation

Postby Andy Trezise » Thu Nov 08, 2007 6:35 pm

A big thank you Loïc !!

That has saved me hours of work.
Andy Trezise
 
Posts: 10
Joined: Wed Nov 07, 2007 1:39 am


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest