Home > Back-end >  How again on image loading pictures of loading a transparent PNG watermark images
How again on image loading pictures of loading a transparent PNG watermark images

Time:09-16

As title, nasty, online waiting, JieTie immediately

CodePudding user response:

Is there may not be clear, there are two images, one is a photo of JPG, a is the log image (PNg transparency) of the company, think through the program, the log image as a JPG image watermark, how to do??? Master waiting for reply

CodePudding user response:

This need, corresponding to the bitmap pixel of image 1 will log images show area and size, set the bitmap, then log in the bitmap pixels in some way, coupled into the image 1,

CodePudding user response:

Earlier Delphi does not support pngimage unit, need additional one,
 
USES the
Pngimage, jpeg.
Var
Jp: TJPEGImage;
PNG: TPngImage;
TMP: TBitmap;
The begin
PNG:=TPngImage. Create;
Jp:=TJPEGImage. Create;
TMP:=Tbitmap. Create;
Try
PNG. LoadFromFile (' d: \ Amy polumbo ng);
Jp. LoadFromFile (' d: \ b.j pg);
TMP. Assign (jp);
TMP. Canvas. The Draw (0, 0, PNG);
Jp. Assign (TMP);
Image1. Picture. Assign (jp);
Image1. Picture. SaveToFile (' d: \ SAN Antonio pg);
The finally
PNG. Free;
Jp. Free;
TMP. Free;
end;
end;

CodePudding user response:

In the controls in the picture??? , and then put a image,,,,

If I think too simple,,,,

CodePudding user response:

Imageen, or search the watermarking image code, one is the one

CodePudding user response:


Method one: to draw the picture the BMP directly, then the PNG map to BMP, then displayed
Method 2: use paintBox, his painting

CodePudding user response:

Personal think, transparent watermark should be source images (a region) and the watermark image Pixels some sort of operation, with a TBitmap Pixels [x] [y] can get image Pixels,

CodePudding user response:

If it is use it is very simple, FMX through logos alpha channel setting, mapping the past is translucent,
If is the VCL, direct approach is the way of using ScanLine, get the GRBA data source figure and the target figure,
Orientation to the particular plot to map the location of the, and then through the source and target BGR three bytes to revise the target and source Alpha channel operation scanline information is ok,,

The target R=R * (A) (255 - source/255) + R x sources A/255
GB weight at the same, write by heart, their search alpha formula to know on the Internet,

CodePudding user response:

If you on image processing is very strong, can be the LOG yourself onto the from the corresponding position
If you can't use ImageEN controls

CodePudding user response:

ImageEN can achieve your needs

CodePudding user response:

1, ImageEN effect is not good;
2, PNG - & gt; TBitMap;
3, to clear the figure
Procedure DrawTransparent (MB_Bitmap: TBitmap; MB_x MB_y: Integer; Y_Bitmap: TBitmap; TrCol: TColor);//MB_Bitmap destination bitmap Y_Bitmap source bitmap
Var
BmpXOR bmpAND, bmpINVAND bmpTarget: TBitmap;
Oldcol: Longint;
The begin
Try
BmpAND:=TBitmap. Create;
BmpAND. Width:=Y_Bitmap. Width;
BmpAND. Height:=Y_Bitmap. Height;
BmpAND. Monochrome:=True;
Oldcol:=SetBkColor (Y_Bitmap. Canvas. Handle, ColorToRGB (TrCol));
BitBlt (bmpAND. Canvas. Handle, 0, 0, Y_Bitmap. Width, Y_Bitmap. Height, Y_Bitmap. Canvas. Handle, 0, 0, SRCCOPY);
SetBkColor (Y_Bitmap. Canvas. Handle, oldcol);
BmpINVAND:=TBitmap. Create;
BmpINVAND. Width:=Y_Bitmap. Width;
BmpINVAND. Height:=Y_Bitmap. Height;
BmpINVAND. Monochrome:=True;
BitBlt (bmpINVAND. Canvas. Handle, 0, 0, Y_Bitmap. Width, Y_Bitmap. Height, bmpAND. Canvas. Handle, 0, 0, NOTSRCCOPY);
BmpXOR:=TBitmap. Create;
BmpXOR. Width:=Y_Bitmap. Width;
BmpXOR. Height:=Y_Bitmap. Height;
BitBlt (bmpXOR. Canvas. Handle, 0, 0, Y_Bitmap. Width, Y_Bitmap. Height, Y_Bitmap. Canvas. Handle, 0, 0, SRCCOPY);
BitBlt (bmpXOR. Canvas. Handle, 0, 0, Y_Bitmap. Width, Y_Bitmap. Height, bmpINVAND. Canvas. Handle, 0, 0, SRCAND);
BmpTarget:=TBitmap. Create;
BmpTarget. Width:=Y_Bitmap. Width;
BmpTarget. Height:=Y_Bitmap. Height;
BitBlt (bmpTarget. Canvas. Handle, 0, 0, Y_Bitmap. Width, Y_Bitmap. Height, MB_Bitmap. Canvas. Handle, MB_x, MB_y, SRCCOPY);
BitBlt (bmpTarget. Canvas. Handle, 0, 0, Y_Bitmap. Width, Y_Bitmap. Height, bmpAND. Canvas. Handle, 0, 0, SRCAND);
BitBlt (bmpTarget. Canvas. Handle, 0, 0, Y_Bitmap. Width, Y_Bitmap. Height, bmpXOR. Canvas. Handle, 0, 0, SRCINVERT);
BitBlt (MB_Bitmap. Canvas. Handle, MB_x MB_y, Y_Bitmap. Width, Y_Bitmap. Height, bmpTarget. Canvas. Handle, 0, 0, SRCCOPY);
The finally
BmpXOR. Free;
BmpAND. Free;
BmpINVAND. Free;
BmpTarget. Free;
end; {the End of the TRY section}
end;

4, Image1. Picture. Bitmap:=BMP; The transparent images to import the Image
5, Image1. Transparent:=TRUE;

CodePudding user response:

Using a third party controls: http://download.csdn.net/detail/zwd183335/5029010
  • Related