I accidently sent that without finishing, sorry.
What I was *going* to say is that the code below results in a single frame
tif. In fact as soon as I rotate the page, the frame count returned by
GetFrameCount() changes from (whatever it was) to 1. It seems that
perfoming operations on a tif like this invalidates it somehow?
I'm still reading online for various tips and tricks, but not finding too
much about specifically editing a tif like this. The only thing I can think
of would be to pull all the frames out, perform operations, then rebuild the
tif.
Is that what others are doing?
I've run some tests and even that is proving a little more difficult than I
had though. Lots to learn!
-Steve
>I would like to rotate pages in a multi-page tiff. Here is my first
>attempt:
[quoted text clipped - 19 lines]
> _attachment.Save(@"C:\StompTest.tif");
> }
> I accidently sent that without finishing, sorry.
>
[quoted text clipped - 3 lines]
> GetFrameCount() changes from (whatever it was) to 1. It seems that
> perfoming operations on a tif like this invalidates it somehow?
Ah. Well, not something I know about first-hand, but that sounds about
right. I'd guess the RotateFlip() method is just a simple helper that
basically creates a new internal image, copying the original into the new
one thereby replacing it.
> I'm still reading online for various tips and tricks, but not finding too
> much about specifically editing a tif like this. The only thing I can
> think
> of would be to pull all the frames out, perform operations, then rebuild
> the
> tif.
Sounds like a reasonable workaround to me. I don't view the .NET
Framework as being a full-featured image editing framework. It has some
basic functionality, but it still leaves lots of things for you to manage
manually. Assuming .NET has a way for you to generate a multi-frame image
(haven't done that myself), that seems like a better way to go.
BTW, if performance is important, you may want to avoid using RotateFlip()
in this case, given that it does generate a brand new image without any
other frames. Using RotateFlip(), you'd have to copy your original Image
so that you don't muck it up with the call to RotateFlip(), and then copy
the rotated image into the new Image you're building.
Instead, you should just use Graphics.FromImage() on the Image you're
building so that you can draw into its current frame, set the Transform
property of the Graphics so that drawing the original image into the new
one is rotated as you desire, and then just draw the original image
directly into the new one.
Pete
Steve K. - 13 Jan 2008 01:29 GMT
>> I accidently sent that without finishing, sorry.
>>
[quoted text clipped - 21 lines]
> manually. Assuming .NET has a way for you to generate a multi-frame image
> (haven't done that myself), that seems like a better way to go.
I agree, it can't do it all. It does somethings so well that I've come to
expect it to "do everything" which of course is unreasonable! ;0)
> BTW, if performance is important, you may want to avoid using RotateFlip()
> in this case, given that it does generate a brand new image without any
> other frames. Using RotateFlip(), you'd have to copy your original Image
> so that you don't muck it up with the call to RotateFlip(), and then copy
> the rotated image into the new Image you're building.
Performance is not an issue, however this is a good point and something I
will keep in mind.
> Instead, you should just use Graphics.FromImage() on the Image you're
> building so that you can draw into its current frame, set the Transform
> property of the Graphics so that drawing the original image into the new
> one is rotated as you desire, and then just draw the original image
> directly into the new one.
Yes, this is what I've started to do.
Thanks again for the great help Peter, I appreciate it.
-Steve
> Pete