15,902,198 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Ajesh Kumar.T.T (Top 3 by date)
Ajesh Kumar.T.T
19-Nov-13 8:10am
View
I am not familiar with this library. But I found similar issue while creating mp4 video files from raw image data. I used Media Foundation APIs for this purpose. In that case encoding gets failed while given RGB24 format. I solved it by converting RGB24 to RGB32 by using the manual looping.
Is this conversion is needed for image data or it for video?
Ajesh Kumar.T.T
28-Sep-12 0:19am
View
I am using GDI plus for conversion, and I tried the following code. But this does not work.
// Create a BITMAPINFOHEADER.
INT nNumColors = 256;
UINT uHeaderSize = nNumColors * sizeof( RGBQUAD ) + stBitmapInfo.bmiHeader.biSize;
INT nPaletteSize = nNumColors * sizeof( RGBQUAD );
// Bitmap Info Header
BYTE* pbyBMInfo = 0;
ITF_NEW_ARRAY( pbyBMInfo, BYTE, uHeaderSize );
ZeroMemory( pbyBMInfo, uHeaderSize );
// Fill Header
LPBITMAPINFO pstBMInfo = reinterpret_cast<lpbitmapinfo>( pbyBMInfo );
memcpy( pstBMInfo, &stBitmapInfo, sizeof( BITMAPINFOHEADER ));
RGBQUAD* pRGB = new RGBQUAD[nNumColors];
// Color table filled in pRGB.
BYTE* pbyPixelData = new BYTE[width * height];
// Pixel data filled in pbyPixelData.
Gdiplus::BitmapData RGBData;
memcpy( pstBMInfo + sizeof( BITMAPINFOHEADER ), pRGB, nPaletteSize );
pBitmapImg = new Gdiplus::Bitmap( pstBMInfo, pbyPixelData );
Gdiplus::Rect ImageRect( 0, 0, width, height );
Gdiplus::Status eRetStatus = pBitmapImg->LockBits( &ImageRect, Gdiplus::ImageLockModeRead,
PixelFormat24bppRGB, &RGBData );
if( Gdiplus::Ok != eRetStatus )
{
pBitmapImg->UnlockBits( &RGBData );
// Error case. Return
}
BYTE* pbyRgbBuffer = new BYTE[RGBData.Height * RGBData.Width * 3];
BYTE* pbyConvertedBuffer = reinterpret_cast<byte*>( RGBData.Scan0 );
for( int nRowIndex = 0; nRowIndex < RGBData.Height; ++nRowIndex )
{
int nNewBufferRowPos = nRowIndex * RGBData.Width * 3;
int nRGBRowPos = nRowIndex * RGBData.Stride;
memcpy( pbyRgbBuffer + nNewBufferRowPos, pbyConvertedBuffer + nRGBRowPos, RGBData.Width * 3 );
}
ULONG ulPixelDataSize = RGBData.Height * RGBData.Width * 3;
BYTE byNewSamplesPerPixel = 3;
pBitmapImg->UnlockBits( &RGBData );
Ajesh Kumar.T.T
27-Sep-12 2:53am
View
This is one time consuming process. Actualy I have a buffer which contains BitmapInfo + pixel data. this pixel data is in the palette format. Bitmapinfo structure contains color table. This can be solved by using LockBits method but I don't know how to use LockBits method for converting buffer to buffer. I found a lot of such conversions, but they are mainly processed one input file.