Hi everyone!
I have a question for you.
OK. Here goes.
I'm writing a utility which will go through all pages in a multi-page TIFF image in order to find landscaped pages, rotate them to make them portrait and save the image. There could be multiple TIFF images, so I need to perform batch operation within specified directory; and number of pages in TIFF images could be anywhere from 1 to several thousands.
So I'm trying to use Image Admin and Image Edit controls available with VB. In order to be able to edit image I have to use Display method of Image Edit control, so every page which got displayed gets rotated. The problem is that as soon as I display next page all changes made to the previous one are discarded. So when I save the file, apparently only the last page gets to keep changes.
Here's a piece of code, that I've come up with to overcome this problem.
Private Sub cmdRotate_Click()
Dim h, w, pc, i
ImgEdit1.Image = "C:\Temp\1.tif"
pc = ImgEdit1.PageCount
For i = 1 To pc
ImgEdit1.Page = i
ImgEdit1.Display
h = ImgEdit1.ImageHeight
w = ImgEdit1.ImageWidth
If w > h Then
ImgEdit1.RotateLeft
End If
ImgEdit1.Save
h = 0
w = 0
Next
MsgBox "Done!!!"
End Sub
But the other problem is - it's very slow. Let's say third-party application rotates 1000-page TIFF image - 130 MB - in 5 minutes, while the same image gets processed with my code in about one hour. I know why it's slow. What I didn't figure out yet is how to make it faster.
Could you advise me as to what approach is better to use to make it work?
Thank you.
I have a question for you.
OK. Here goes.
I'm writing a utility which will go through all pages in a multi-page TIFF image in order to find landscaped pages, rotate them to make them portrait and save the image. There could be multiple TIFF images, so I need to perform batch operation within specified directory; and number of pages in TIFF images could be anywhere from 1 to several thousands.
So I'm trying to use Image Admin and Image Edit controls available with VB. In order to be able to edit image I have to use Display method of Image Edit control, so every page which got displayed gets rotated. The problem is that as soon as I display next page all changes made to the previous one are discarded. So when I save the file, apparently only the last page gets to keep changes.
Here's a piece of code, that I've come up with to overcome this problem.
Private Sub cmdRotate_Click()
Dim h, w, pc, i
ImgEdit1.Image = "C:\Temp\1.tif"
pc = ImgEdit1.PageCount
For i = 1 To pc
ImgEdit1.Page = i
ImgEdit1.Display
h = ImgEdit1.ImageHeight
w = ImgEdit1.ImageWidth
If w > h Then
ImgEdit1.RotateLeft
End If
ImgEdit1.Save
h = 0
w = 0
Next
MsgBox "Done!!!"
End Sub
But the other problem is - it's very slow. Let's say third-party application rotates 1000-page TIFF image - 130 MB - in 5 minutes, while the same image gets processed with my code in about one hour. I know why it's slow. What I didn't figure out yet is how to make it faster.
Could you advise me as to what approach is better to use to make it work?
Thank you.