Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

transpose a bitmap

Posted on 2009-05-10
5
670 Views
Last Modified: 2013-11-22
I need a function to transpose ( flip and rotate CCW 90 deg ) a bitmap simply and fast. Any ideas?
0
Comment
Question by:IOOI
  • 3
  • 2
5 Comments
 
LVL 13

Expert Comment

by:rfwoolf
ID: 24349419
Google is your friend:
http://www.delphi3000.com/article.asp?ID=2764

Procedure TurnImage(Src, Dst: TImage);
var x,y: integer;
begin
  Dst.Width:= Src.Height; Dst.Height:= Src.Width;
  For x:= 0 to Src.Width-1 do begin
    For y:= 0 to Src.Height-1 do begin
      Dst.Canvas.Pixels[(Src.Height-1)-y,x]:= Src.Canvas.Pixels[x,y];
    end;
  end;
end;

You can adapt this to do what you want.
0
 
LVL 13

Expert Comment

by:rfwoolf
ID: 24349439
Also, I actually couldn't go to that link when I found it in google - I had to check the Google cache.
But if you do go to the cache of that link you'll see  the above procedure PLUS improvements on it, stuff like being able to accept jpegs, being able to flip the image, being able to rotate it, and combinations thereof.
0
 

Author Comment

by:IOOI
ID: 24349442
I have googled a lot which is why I finally asked.

I'm aware of Canvas.Pixel but it is very slow because you can access individual pixels.

I was looking for a solution that uses scanline and simply switches x,y of individual pixels to get a transpose.
0
 
LVL 13

Accepted Solution

by:
rfwoolf earned 200 total points
ID: 24349611
If you haven't already, have a look at this page to see if there's a component or solution that might be able to help you: http://www.efg2.com/Lab/Library/Delphi/Graphics/ImageProcessing.htm
0
 

Author Closing Comment

by:IOOI
ID: 31579955
Thanks! I got a few ideas from that page.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question