Rabu, 29 April 2009

Invert Image Processing and Source Code In Delphi

Hi Friend. Do You need Source Code of Image Processing..? But I’m only have in Delphi Programming. It is easy to Follow and Understand.

Invert Image is one of image processing to invert the color. The easy way to understand is Change Black Color to White and White to Black, but there are variation if the Red, Green and Blue value have variation.

Invert Image Basically obtain from decrease Value of 255 to Red Pixel Value, 255 to Green Pixel Value and 255 to B Pixel Value.



Below is Source Code for Invert Image Processing in Delphi.


procedure TForm1.ToolButtonInvertClick(Sender: TObject);
var i,j :byte;
PH:PByteArray;
R,G,B : integer;
begin
for i:=0 to FormHasil.ImgHasil.Height-1 do
begin
PH:=FormHasil.ImgHasil.Picture.Bitmap.ScanLine[i];
for j:=0 to FormHasil.ImgHasil.Width-1 do
begin
R:=255-PH[3*j];
G:=255-PH[3*j+1];
B:=255-PH[3*j+2];

PH[3*j]:= R;
PH[3*j+1]:= G;
PH[3*j+2]:= B;
end;
end;
FormHasil.ImgHasil.Repaint;
FormHistogram.Histogram;
end;


Please Comment If I’m Wrong. Comment are widely open…!!

Selasa, 28 April 2009

Brightness Image Processing and Source Code In Delphi

Hi Friend. Do You need Source Code of Image Processing..? But I’m only have in Delphi Programming. It is easy to Follow and Understand.

Brightness manipulation is widely use in image processing. We give a value to the procedure to change the brightness. Positive value mean increase brighness and negative value mean decrease brightness.

(a. normal image)

(b. decrease brightness, histogram spread)


(c. increase brightness 1, histogram collect together in right side)

(d. increase brightness 2, histogram collect together in right side)


Below is Source Code for Brightness Image Processing in Delphi.


procedure TFormBright_Con.Brightness (A:integer);
var
i, j: integer;
R,G,B : integer;
PH:PByteArray;
begin
for i:= 0 to FormHasil.ImgHasil.Picture.Height-1 do
begin
PH:= FormHasil.ImgHasil.Picture.Bitmap.ScanLine[i];
for j:= 0 to FormHasil.ImgHasil.Picture.Width-1 do
begin
R:= A + round((PH[3*j]/255)*(255-A));
G:= A + round((PH[3*j+1]/255)*(255-A));
B:= A + round((PH[3*j+2]/255)*(255-A));

if R >255 Then R:=255
else if R<0 Then R:=0;
if G>255 then G:=255
else if G<0 Then G:=0;
if B>255 then B:=255
else if B<0 Then B:=0;

PH[3*j] := R;
PH[3*j+1] := G;
PH[3*j+2] := B;

end;
end;
end;




Please pass the value from SpinEdit Maybe or by TrackBar or manualy by Edit.
Example :

Brightness(TrackBar.Position);

Please Comment If I’m Wrong. Comment are widely open…!!

Kamis, 16 April 2009

Show Hidden Files Using DOS

Hi Friends, This is how to Show Hidden Files Using DOS.
Just Use This Command in Command Prompt :

dir/ah

or

dir/ah/p/w --> for more detail output

But First You Must in the directory that you want to Check, In the picture below, i use Drive M. One hidden file in drive M is scan0003.jpg. Picture below show the result :


picture 1. using dir/ah


picture 2. using dir/ah/p/w




Return Hidden File to Normal using cmd (attrib)

Your flashdisk attack by viruses..?
and some file become hidden..?
and the file can't be restore to normal after viruses have been clean..?
try this manner maybe can fix your problem.. I hope it works..

1. if you confuse about using attrib in cmd, see the help with write
help attrib
in cmd (Windows command line)
2. Now go to the flashdisk directory and just write
attrib -R -A -S -H /S /D

and wait a moment..

all the hidden file will be restore to normal.

*) why using (-) ..?
--> just because it mean to be restore. the plus (+) mean to make the file to be hidden, be a system file etc.

Rabu, 15 April 2009

Histogram in Image Processing and Source Code In Delphi

Histogram is The Image Processing Basic That Shows How Much Pixel Value of Red Green And Blue in their Level (usually From 0 to 255) in a Image.


Below is Source Code for Histogram Image in Delphi.


procedure TFormHistogram.Histogram;
var i,j :integer;
temp:PByteArray;

begin
for i:=0 to 255 do
begin
R[i]:=0;
G[i]:=0;
B[i]:=0;
end;
for i:=0 to FormHasil.ImgHasil.Picture.Bitmap.Height-1 do
begin
temp:=FormHasil.ImgHasil.Picture.Bitmap.ScanLine[i];
for j:= 0 to FormHasil.ImgHasil.Picture.Bitmap.Width-1 do
begin
inc(B[temp[3*j]]);
inc(G[temp[3*j+1]]);
inc(R[temp[3*j+2]]);
end;
end;

FormHistogram.ChartR.Series[0].Clear;
FormHistogram.ChartG.Series[0].Clear;
FormHistogram.ChartB.Series[0].Clear;
for i:=0 to 255 do
begin
FormHistogram.ChartR.Series[0].AddXY(i, R[i]);
FormHistogram.ChartG.Series[0].AddXY(i, G[i]);
FormHistogram.ChartB.Series[0].AddXY(i, B[i]);
end;
end;



Please Comment If I’m Wrong. Comment are widely open…!!

Senin, 06 April 2009

Desaturate Effect in Photoshop

Hi, welcome back in Photoshop Tutorial. This time i try to show the Desaturate Effect in Photoshop.

here is the original image (unud building).

then use the Rectangular Marque Tool to make a Rectangular Selection.


Use Shift + Ctrl + U or Image-->Adjusment-->Desaturate. Below The result.


This Desaturate Effect can be use as Past effect (grayscale side) or Present effect (color side)of the Picture. You can also use another way beside this desaturate effect..^_^

Random Background Color With PHP

The PHP random function (rand()) can be use to random webpage background color. Use this syntax on HTML body


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
</head>
<body bgcolor="<?php echo"#".rand(996699,999999); ?>">
</body>
</html>


Save this code in filetipe of PHP in your server. Then you can check what happen in your browser background color.

The 996699 is the first input color and 999999 is the second input color that use in rand() function.

You can change the color range by 000000 (black) to FFFFFF (white).

MySQL Visual Editor

There are some MySQL visual Editor to make our work easier than using Console with Text Command. Much thing will be easier, like query, connection to another MySQL Server, Back Up, Recovery. All we do in visual context. Several MySQL GUI (Graphical User Interface) are :

1. SQLYog

2. MySQL Query Browser
3. MySQL Maestro
4. Navicat for MySQL


The Navicat is the best and simple to use with more powerfull function. The user interface also nice and Cool.


Date Now in PHP

Wanna Script for date now in PHP..? But the Month is in Indonesian..Just change the Month in The Array..


<?php
$nama_bln=array(1=> "Januari", "Februari", "Maret", "April", "Mei",
"Juni", "Juli", "Agustus", "September",
"Oktober", "November", "Desember");

$tanggal=date("d");
echo "<select name=tgl>";
for ($i=1; $i<=31; $i++){
if ($tanggal==$i)
echo "<option value=$i selected>$tanggal</option>";
else
echo "<option value=$i>$i</option>";
}
echo "</select>";

$bulan=date("m");
echo " <select name=bln>";
for ($i=1; $i<=12; $i++){
if ($bulan==$i)
echo "<option value=$i selected>$nama_bln[$i]</option>";
else
echo "<option value=$i>$nama_bln[$i]</option>";
}
echo "</select>";

$sekarang=date("Y");
echo " <select name=tahun>";
for ($i=2000;$i<=$sekarang;$i++){
if ($sekarang==$i)
echo "<option value=$i selected>$sekarang</option>";
else
echo "<option value=$i>$i</option>";
}
echo "</select>";

?>



Just save as it as date.php and view in your localhost..

PHP-MySQL Connection

Hello i'm come back again, but now with PHP - MySQL Basic Tutorial.

Here we discuss about PHP MySQL Connection. The PHP Programmer usually know about this. There was mysql_connect and mysqli_connect. The function
mysql_connect and mysqli_connect actually have same objectives to provide a database connection, but mysqli_connect is newer version of mysql_connect.

So here is the code :


<?php
$hostname = "localhost";
$username = "root";
$password = "picas";
$database = "mydb";

$conn = mysql_connect($hostname, $username, $password)
or die("Connection fail ...");
mysql_select_db($database, $conn);
?>



<?php
$link = mysqli_connect (localhost, root, picas, mydb);
?>


The
mysqli_connect have shorter code than mysql_connect, and not using mysql_select_db.