?
Solved

Some Image questions.

Posted on 2004-08-24
5
Medium Priority
?
154 Views
Last Modified: 2010-04-05

   How can I take a list of pictures from folder where every image (which are jpeg) is 1600x1200 and resize it to lets say 800x600 ??
   I nead to create a program to run through several folders and resize my images so they will be managable on the web.

     Regards,
       Tomas Helgi
0
Comment
[X]
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
5 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 1200 total points
ID: 11879410
well, i have not the time for a sample, but i suggest following flow

- iterate through the files via findfirst/findnext
- open each file and lookup the metrics
- if to shrink
  - assign your jpeg to a bmp-object
  - create a secondary empty bmp-object, adjust there the needed metrics
  - use bitblt or stretchdraw to copy the first bitmap into the empty bitmap
  - create a new jpg-object, assign the seconf bitmap there
  - save it as new file or overwrite your existing one
- next file

meikl ;-)
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 11879453
"Web picture creator" did it for me..
www.WebPictureCreator.com
0
 
LVL 2

Assisted Solution

by:Molando
Molando earned 800 total points
ID: 11882559
uses jpeg

procedure ResizePicture(path : string; width, height : integer);
var
 sr: TSearchRec;
 jpg : tjpegimage;
 bmp : tBitmap;
begin
 jpg := tJPEGImage.create;
 bmp := tBitmap.Create;
 bmp.width := width;
 bmp.Height := height;
 if FindFirst(path, faAnyFile, sr) = 0 then
    begin
      repeat
        if (pos('.JPG',uppercase(sr.name)) > 0) then  //ok we have found a jpeg
        begin
          jpg.LoadFromFile(sr.name);
          bmp.canvas.stretchdraw(bmp.canvas.cliprect,jpg);
          jpg.assign(bmp);
          jpg.SaveToFile(sr.name);
        end;
      until FindNext(sr) <> 0;
      FindClose(sr);
    end;
  jpg.free;
  bmp.free;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
resizePicture('c:\pic\*.*',800,600);
end;
0
 
LVL 25

Author Comment

by:Tomas Helgi Johannsson
ID: 11884930
I don't know how to split the Accepted answer but Molando should also get something as an assisted answer.
Thanks.

Regards,
  Tomas Helgi
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month13 days, 4 hours left to enroll

777 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