Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » [SOLVED] accessing pixels in JPEG created from memory buffer
Re: accessing pixels in JPEG created from memory buffer [message #21417 is a reply to message #21414] Tue, 19 May 2009 10:25 Go to previous messageGo to previous message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Make sure you add the package plugin/jpg to your project
// Load raw image into memory
FileIn fin(IMAGE_FILE_PATH);
if (!fin.IsOpen()) 
	{ Exclamation("Unable to open file"); return; }
String raw = fin.Get((dword)fin.GetSize());

// Convert String to uncompressed Image
Image img = StreamRaster::LoadStringAny(raw);
// If you know the image format you could also use:
// Image img = JPGRaster().LoadString(raw);
if (IsNull(img)) 
	{ Exclamation("Unknown/Bad image format"); return; }

// If you need to process the image use an ImageBuffer
ImageBuffer ib(img);
RGBA *q = ~ib;
RGBA *eoi = q + ib.GetLength();
while (q < eoi) {
	// Do something to *q
	++q;
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Optimal ctrl refresh
Next Topic: Draw package and console app error
Goto Forum:
  


Current Time: Sat Apr 27 11:49:41 CEST 2024

Total time taken to generate the page: 0.02693 seconds