Board index » delphi » How do I rotate an image (jpeg)?

How do I rotate an image (jpeg)?

Hello,

I have a TImage that contains a jpeg, which I need to rotate 90 degrees.  I
found a small routine to do this, but when I attempt to make any changes to
the image, I receive an exception: "Can only modify an image if it contains
a bitmap."

My questions:  (1) Do I need to convert the image to a bitmap first, rotate
it, and convert it back to jpeg?  If so, are there any code examples of
this?  (2) Is there any other way to rotate a jpeg without converting it to
a bitmap? (I'm using Delphi 4.0.)

Any help is greatly appreciated.

John Roth

 

Re:How do I rotate an image (jpeg)?


Check out Earl F. Glynn excellent web pages on graphics at:

http://www.efg2.com/Lab/Library/Delphi/Graphics/

There is an example of rotating images, and using bitmaps and JPG.

Quote
John Roth wrote:
> Hello,

> I have a TImage that contains a jpeg, which I need to rotate 90 degrees.  I
> found a small routine to do this, but when I attempt to make any changes to
> the image, I receive an exception: "Can only modify an image if it contains
> a bitmap."

> My questions:  (1) Do I need to convert the image to a bitmap first, rotate
> it, and convert it back to jpeg?  If so, are there any code examples of
> this?  (2) Is there any other way to rotate a jpeg without converting it to
> a bitmap? (I'm using Delphi 4.0.)

> Any help is greatly appreciated.

> John Roth

Re:How do I rotate an image (jpeg)?


Charles,

Thanks for the response.  The code I was looking for I found at:

http://www.efg2.com/Lab/ImageProcessing/RotateScanline.htm

Thanks again for the help.

John Roth

Quote
Charles Hacker <C.Hac...@mailbox.gu.edu.au> wrote in message

news:38068771.637517D8@mailbox.gu.edu.au...
Quote
> Check out Earl F. Glynn excellent web pages on graphics at:

> http://www.efg2.com/Lab/Library/Delphi/Graphics/

> There is an example of rotating images, and using bitmaps and JPG.

> John Roth wrote:

> > Hello,

> > I have a TImage that contains a jpeg, which I need to rotate 90 degrees.
I
> > found a small routine to do this, but when I attempt to make any changes
to
> > the image, I receive an exception: "Can only modify an image if it
contains
> > a bitmap."

> > My questions:  (1) Do I need to convert the image to a bitmap first,
rotate
> > it, and convert it back to jpeg?  If so, are there any code examples of
> > this?  (2) Is there any other way to rotate a jpeg without converting it
to
> > a bitmap? (I'm using Delphi 4.0.)

> > Any help is greatly appreciated.

> > John Roth

Other Threads