473,394 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

modifying single frames in a multi frame tiff

I would like to rotate pages in a multi-page tiff. Here is my first
attempt:

<code>
public void RotatePageAndSave(int degrees)
{
RotateFlipType rotateType = RotateFlipType.Rotate180FlipNone;
switch(degrees)
{
case 180: rotateType = RotateFlipType.Rotate180FlipNone; break;
case 90: rotateType = RotateFlipType.Rotate90FlipNone; break;
default: throw new Exception("Unsupported rotation value: " +
degrees);
}

// try drawing on the current frame and saving to a temp folder
_attachment.RotateFlip(rotateType);
int y = _attachment.GetFrameCount(FrameDimension.Page);

Console.WriteLine("The saved file should have {0} pages and the " +
"rotating should be on page {1}", _numPages, _currentPageIndex);
_attachment.Save(@"C:\StompTest.tif");
}
Jan 11 '08 #1
4 3968
On Thu, 10 Jan 2008 23:15:15 -0800, Steve K. <no***@nowhere.comwrote:
I would like to rotate pages in a multi-page tiff. Here is my first
attempt:
And?

Did you have a question?
Jan 11 '08 #2
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
"Steve K." <no***@nowhere.comwrote in message
news:O$**************@TK2MSFTNGP02.phx.gbl...
>I would like to rotate pages in a multi-page tiff. Here is my first
attempt:

<code>
public void RotatePageAndSave(int degrees)
{
RotateFlipType rotateType = RotateFlipType.Rotate180FlipNone;
switch(degrees)
{
case 180: rotateType = RotateFlipType.Rotate180FlipNone; break;
case 90: rotateType = RotateFlipType.Rotate90FlipNone; break;
default: throw new Exception("Unsupported rotation value: " +
degrees);
}

// try drawing on the current frame and saving to a temp folder
_attachment.RotateFlip(rotateType);
int y = _attachment.GetFrameCount(FrameDimension.Page);

Console.WriteLine("The saved file should have {0} pages and the " +
"rotating should be on page {1}", _numPages, _currentPageIndex);
_attachment.Save(@"C:\StompTest.tif");
}

Jan 11 '08 #3
On Fri, 11 Jan 2008 01:25:01 -0800, Steve K. <no***@nowhere.comwrote:
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?
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
Jan 11 '08 #4
"Peter Duniho" <Np*********@nnowslpianmk.comwrote in message
news:op***************@petes-computer.local...
On Fri, 11 Jan 2008 01:25:01 -0800, Steve K. <no***@nowhere.comwrote:
>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?

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.
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

Jan 13 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alex | last post by:
I need to duplicate some of the multi-page tiff and thumbnail viewing functionality found in the Microsoft Office Document Imaging application for an in-house company application. Does anyone...
0
by: gene | last post by:
Raw DMS single- vs. multi-table tablespaces I am looking for info re recommendations and performance comparisons of single vs. multiple table allocations in raw DMS tablespaces. While it seems...
1
by: Prasad More | last post by:
Hello, I am trying to write a text on Multi-page TIFF image using C# and .NET GDI+. I have written following code to do this. When I execute this code I get "Invalid Parameter User. at...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
2
by: Curtis | last post by:
I'm looking for a way to view thumbnails and large images of multi-page tiffs.I have conducted some intial research and it appears that to accomplish this in VB.net I will have to purchase an...
0
by: liupei | last post by:
how to do with the multi-frame GIF, I used the PIL ,but it seems not support?
0
by: V Deepak | last post by:
Hi All, Please give me any leads in converting a base64 string into a multiple page tiff. I am actually struck while saving multiple images into a single multi-page tiff, is there anything...
2
by: matthews | last post by:
Is there a means whereby a multi-page TIFF image can be displayed in an Oracle Form, or is there a solution that can be used. Johann Matthews
0
by: =?Utf-8?B?VmVuZWRpY3Q=?= | last post by:
Hi All, Knowing that .net 1.1 and .net 2.0 doesn't support due to GDI+. Does anyone know whether WPF can support the decoding of multi frame TIFF with JPEG compression? Thanks in advance.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.