Board index » delphi » Picture rotation

Picture rotation


2003-09-29 09:22:31 PM
delphi238
I have code now that will allow me to load a .jpg into an image.
Unfortunately some pictures were taken 90 degrees rotated. Is there any
quick way to rotate an image, or am I in for copying the image pixel by
pixel?
TIA
Geoff
 
 

Re:Picture rotation

In article <XXXX@XXXXX.COM>, Geoff writes:
Quote
I have code now that will allow me to load a .jpg into an image.
Unfortunately some pictures were taken 90 degrees rotated. Is there any
quick way to rotate an image, or am I in for copying the image pixel by
pixel?
You can rotate the world coordinate system of the canvas you draw the JPG
on (which means you do have to draw it yourself, e.g. on a paintbox,
instead of using a TImage to do the work for you). This is something that
only works on NT platforms, though. See SetWorldTransform in the MS
Platform SDK help.
If you are looking for some code to rotate bitmaps try Earl Glynns Delphi
pages www.efg2.com/Lab/Library/Delphi, he has a lot of
graphic-related routines on site.
Peter Below (TeamB)
Use the newsgroup archives :
www.mers.com/searchsite.html
www.tamaracka.com/search.htm
groups.google.com
www.prolix.be
 

Re:Picture rotation

Thanks Peter but you don't seem able to do this with a JPEG image.
What I have found is that you can copy the canvas to another canvas and then
manipulate it.
Getting there slowly!
Geoff
"Peter Below (TeamB)" writes:
Quote
In article <XXXX@XXXXX.COM>, Geoff writes:
>I have code now that will allow me to load a .jpg into an image.
>Unfortunately some pictures were taken 90 degrees rotated. Is there any
>quick way to rotate an image, or am I in for copying the image pixel by
>pixel?

You can rotate the world coordinate system of the canvas you draw the JPG
on (which means you do have to draw it yourself, e.g. on a paintbox,
instead of using a TImage to do the work for you). This is something that
only works on NT platforms, though. See SetWorldTransform in the MS
Platform SDK help.

If you are looking for some code to rotate bitmaps try Earl Glynns Delphi
pages www.efg2.com/Lab/Library/Delphi, he has a lot of
graphic-related routines on site.

--
Peter Below (TeamB)
Use the newsgroup archives :
www.mers.com/searchsite.html
www.tamaracka.com/search.htm
groups.google.com
www.prolix.be
 

Re:Picture rotation

In article <XXXX@XXXXX.COM>, Geoff writes:
Quote
Thanks Peter but you don't seem able to do this with a JPEG image.
Well, you have to convert it to a TBitmap first.
Peter Below (TeamB)
Use the newsgroup archives :
www.mers.com/searchsite.html
www.tamaracka.com/search.htm
groups.google.com
www.prolix.be