Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

resizing a jpeg 1

Status
Not open for further replies.

nicasa

Programmer
Feb 3, 2003
54
ES
Hi There,

Is it at all possible to resize a jpeg file programmatically using a method from say TJpeg ?

regards,

steven Matthews
 
Try this..

// ---------------- IN YOUR HEADER ------------------ //

#include <jpeg.hpp>

// -------------------------------------------------- //

TJPEGImage *JPG = new TJPEGImage(); // Create new JPG
JPG->LoadFromFile("Image.jpg"); // specify your own Image

Graphics::TBitmap *map = new Graphics::TBitmap();
map->Width = 100; // change to what you require
map->Height = 200;
map->Canvas->StretchDraw(Rect(0,0,100,200),JPG);
JPG->Assign(map);

delete map;
map = NULL;

JPG->SaveToFile("Image.jpg");

delete JPG;
JPG = NULL;

// -------------------------------------------------- //
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top