Home > Software engineering >  How to use GDI reads a JPG, and create a transparent channel and assignment.
How to use GDI reads a JPG, and create a transparent channel and assignment.

Time:09-22

In a recent study how extracted directly from within the SWF file PNG images,
Store PNG image if the saved SWF select lossy compression mode when save,
The SWF file in PNG image is divided into two parts to save downloaded, SWF again when this PNG image to be obtained image to restore,
SWF save PNG two parts data respectively
The first part: as a JPG picture, without a clear channel, extracted directly, is a piece of black JPG image reproduction, (because don't understand JPG image structure, so can't extract the pixel information, checked on the Internet, this is beneath, reduction of RGB seem very trouble, so temporarily give up directly extracting image pixels)
The second part: as a compressed transparent channel data, record PNG image pixel is RGBA, RGBA, RGBA... , this kind of mode, the second part, only record A, A, A, A, A, A... This record mode,
Is like a picture at 50, 50 long, then the second part of the data length is 50 * 50 after decompression, is similar to a matte black and white image data, but not the actual picture,

Now I merge mode is that the JPG directly into PNG, and then the corresponding to each pixel of the RGBA A fill data into pixels, but this method is very time-consuming,
If use GDI combine the second part of the data to the first part, what is the specific way of thinking, the GDI is not very understanding, hope the great god,

After the first part of the JPG image is converted into a PNG image, is a transparent channel of the PNG images, arrange for RGB pixel, RGB, RGB... This arrangement, and I after decompiling software is used to derive the check, found that images with decompiled export of RGB is biased, that is to say that transformation has an impact on one time,
SWF file at the time of call are corresponding, in an instant that is what technology, can make the two parts so quickly merged into PNG images,

I hope god can help solve, thank you for (great god have to do is talk about ideas, and I don't understand the source, not C,,,,,,,),

CodePudding user response:

GDI +
Bitmap: : FromStream
Bitmap: : GetPixel
Bitmap: : SetPixel

CodePudding user response:

Bitmap MyBitMap;

MyBitMap. FromFile (szFilePath);

CodePudding user response:

You're going to be open. SWF ( S hock W ave Flash) file, read the content, and finally create a PNG file?
Is the use of com components?
The class CShockwaveFlash: public CWnd
{
Protected:
DECLARE_DYNCREATE (CShockwaveFlash)
Public:
Clsids const& GetClsid ()
{
The static clsids const clsids
= {0, 0, 0, {xb8 0 x96, 0, 0 x44, 0 x45, 0 x53, 0 x54, 0 x0, 0 x0}};
Return clsids;
}

Would you mind showing me your code?

CodePudding user response:

Use GDI +
  • Related