Click here to Skip to main content
16,012,223 members

Comments by RKT S (Top 18 by date)

RKT S 26-Mar-11 0:24am View    
thanks manfred...it worked...i got the mistake...
RKT S 24-Mar-11 0:09am View    
hi manfred....i did the changes which you asked me to do... but still the watermark image is the one without logo on it... plz help and let me know if i am doing something wrong here.. the final function which i have used is

public Bitmap AddWatermark(Bitmap bImg, Bitmap logo)
{

Bitmap bmPhoto = bImg;
//bmPhoto.SetResolution(bImg.HorizontalResolution,bImg.VerticalResolution);
Graphics grPhoto = Graphics.FromImage(bmPhoto);

Bitmap imgWatermark=logo;
int wmWidth = imgWatermark.Width;
int wmHeight = imgWatermark.Height;

//Create a Bitmap based on the previously modified photograph Bitmap
ImageAttributes imageAttributes = new ImageAttributes();
ColorMap colorMap = new ColorMap();
colorMap.OldColor = Color.FromArgb(255, 0, 255, 0);
colorMap.NewColor = Color.FromArgb(0, 0, 0, 0);
ColorMap[] remapTable = { colorMap };
imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);
float[][] colorMatrixElements = {
new float[] {1.0f, 0.0f, 0.0f, 0.0f, 0.0f},
new float[] {0.0f, 1.0f, 0.0f, 0.0f, 0.0f},
new float[] {0.0f, 0.0f, 1.0f, 0.0f, 0.0f},
new float[] {0.0f, 0.0f, 0.0f, 0.3f, 0.0f},
new float[] {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}};
ColorMatrix wmColorMatrix = new ColorMatrix(colorMatrixElements);
imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default,ColorAdjustType.Bitmap);
grPhoto.DrawImage(imgWatermark, new Rectangle(0, 0, wmWidth, wmHeight), 0, 0, wmWidth, wmHeight, GraphicsUnit.Pixel, imageAttributes);

return bmPhoto;

}
RKT S 24-Mar-11 0:08am View    
Deleted
hi manfred....i did the changes which you asked me to do... but still the watermark image is the one without logo on it... plz help and let me know if i am doing something wrong here.. the final function which i have used is public Bitmap AddWatermark(Bitmap bImg, Bitmap logo) { Bitmap bmPhoto = bImg; int phWidth = bmPhoto.Width; int phHeight =bmPhoto.Height; //bmPhoto.SetResolution(bImg.HorizontalResolution,bImg.VerticalResolution); Graphics grPhoto = Graphics.FromImage(bmPhoto); Bitmap imgWatermark=logo; int wmWidth = imgWatermark.Width; int wmHeight = imgWatermark.Height; //Create a Bitmap based on the previously modified photograph Bitmap ImageAttributes imageAttributes = new ImageAttributes(); ColorMap colorMap = new ColorMap(); colorMap.OldColor = Color.FromArgb(255, 0, 255, 0); colorMap.NewColor = Color.FromArgb(0, 0, 0, 0); ColorMap[] remapTable = { colorMap }; imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap); float[][] colorMatrixElements = { new float[] {1.0f, 0.0f, 0.0f, 0.0f, 0.0f}, new float[] {0.0f, 1.0f, 0.0f, 0.0f, 0.0f}, new float[] {0.0f, 0.0f, 1.0f, 0.0f, 0.0f}, new float[] {0.0f, 0.0f, 0.0f, 0.2f, 0.0f}, new float[] {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}}; ColorMatrix wmColorMatrix = new ColorMatrix(colorMatrixElements); imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default,ColorAdjustType.Bitmap); int xPosOfWm = ((phWidth - wmWidth) - 10); int yPosOfWm = 10; grPhoto.DrawImage(imgWatermark,new Rectangle(xPosOfWm, yPosOfWm, wmWidth, wmHeight), 0, 0,wmWidth,wmHeight,GraphicsUnit.Pixel,imageAttributes); return bmPhoto; }
RKT S 24-Mar-11 0:02am View    
Deleted
hi manfred....i did the changes which you asked me to do...
but still the watermark image is the one without logo on it...
plz help and let me know if i am doing something wrong here..
the final function which i have used is

public Bitmap AddWatermark(Bitmap bImg, Bitmap logo)
{

Bitmap bmPhoto = bImg;
int phWidth = bmPhoto.Width;
int phHeight =bmPhoto.Height;
//bmPhoto.SetResolution(bImg.HorizontalResolution,bImg.VerticalResolution);
Graphics grPhoto = Graphics.FromImage(bmPhoto);

Bitmap imgWatermark=logo;
int wmWidth = imgWatermark.Width;
int wmHeight = imgWatermark.Height;

//Create a Bitmap based on the previously modified photograph Bitmap
ImageAttributes imageAttributes = new ImageAttributes();
ColorMap colorMap = new ColorMap();
colorMap.OldColor = Color.FromArgb(255, 0, 255, 0);
colorMap.NewColor = Color.FromArgb(0, 0, 0, 0);
ColorMap[] remapTable = { colorMap };
imageAttributes.SetRemapTable(remapTable, ColorAdjustType.Bitmap);
float[][] colorMatrixElements = {
new float[] {1.0f, 0.0f, 0.0f, 0.0f, 0.0f},
new float[] {0.0f, 1.0f, 0.0f, 0.0f, 0.0f},
new float[] {0.0f, 0.0f, 1.0f, 0.0f, 0.0f},
new float[] {0.0f, 0.0f, 0.0f, 0.7f, 0.0f},
new float[] {0.0f, 0.0f, 0.0f, 0.0f, 1.0f}};
ColorMatrix wmColorMatrix = new ColorMatrix(colorMatrixElements);
imageAttributes.SetColorMatrix(wmColorMatrix, ColorMatrixFlag.Default,ColorAdjustType.Bitmap);
int xPosOfWm = ((phWidth - wmWidth) - 10);
int yPosOfWm = 10;
grPhoto.DrawImage(imgWatermark,new Rectangle(xPosOfWm, yPosOfWm, wmWidth, wmHeight), 0, 0,wmWidth,wmHeight,GraphicsUnit.Pixel,imageAttributes);

return bmPhoto;

}
RKT S 23-Mar-11 21:43pm View    
thnaks manfred...