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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I WANT TO READ PIXELS IN A JPG IMAGE, HOW CAN I DO IT?

Status
Not open for further replies.

fayevalentine

Programmer
Jun 2, 2004
38
MX
I want to read pixels in a jpg image with

Canvas->Pixels[][]; but appears a message:
'Can only modify an image if it contains a bitmap'

how can I read pixels with this instruction? or Can I read
pixels in JPG images with another method?
 
I'm going out on a limb here because I don't regularly deal with graphics but suggests using the class TJPEGImage. Look at it for a start.

James P. Cottingham
[sup]
There's no place like 127.0.0.1.
There's no place like 127.0.0.1.
[/sup]
 
Convert jpeg to bmp format using TJPEGImage object and then call methods from the TBitmap class, including read pixel(},

SteveM
 
N here is the sample:

TJPEGImage * sumjpg=new TJPEGImage;
Graphics::TBitmap * sumbmp=new Graphics::TBitmap;

try
{
sumjpg->LoadFromFile("c:\\pamelaanderson.jpg");
sumbmp->Assign(sumjpg);

//Add yer code here (to draw bigger tits for ex.)
//sumbmp->Canvas->DrawBiggerTits(500); //in pixels ofcoz

//n save it
sumjpg->Assign(sumbmp);
sumjpg->SaveToFile("c:\\reallypamelaanderson.jpg");
}
__finally
{
delete sumjpg;
delete sumbmp;
}

Hope it helps.

unbornchikken
 
Thank you very much all of you!
I just started to use this language and I think that is fantastic although a little hard to learn.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top