Usage goes like this: pic2htm.exe file1.jpg file2.htm 4
The last parameter (4 in this example) is the amount to scale down by.
For full-sized, put a 1, for half size, put 2, etc. You must have something
there
as there are no checks to see if there's nothing there.
Below is the code.
using System;
using System.IO;
using System.Drawing;
using System.Drawing.Drawing2D;
class pic2htm {
public static void Main(string[] args) {
Bitmap b = (Bitmap)Image.FromFile(args[0]);
StreamWriter SW = new StreamWriter(args[1]);
SW.WriteLine("<b><font size='1pt'><pre>");
for(int y=0;y<b.Height;y+=int.Parse(args[2])) {
for(int x=0;x<b.Width;x+=int.Parse(args[2])) {
SW.Write("<font color='#" + b.GetPixel(x,y).Name.Substring(2)
+ "'>");
SW.Write(((byte)b.GetPixel(x,y).ToArgb())>>7);
SW.Write("</font>");
}
SW.WriteLine();
}
SW.WriteLine("</pre></font></b>");
SW.Close();
SW = null;
}
}
Image to HTML
You might also like...
HTML forum discussion
-
USB Drive Activity Logger!
by coque0912 (7 replies)
-
Exporting data from a repeater to an Excel sheet
by TomBlack (28 replies)
-
Calculate Date of Birth from Age
by k.prashanth (7 replies)
-
Windows Service, getting outOf memory exception
by programmerdude2341 (3 replies)
-
How to Make Default Button?
by puspitaonlinebooks (24 replies)
HTML podcasts
-
.NET Rocks: Stories from CodeMash!
Published 8 years ago, running time 0h56m
While at CodeMash, Carl and Richard collected some great stories. First up is Evan Huack, who digs into cudafy, a library on codeplex that allows you to run C# code (any IL code actually) on your GPU. The second story is about Jessie Shternshus and her company The Improv Effect. Jessie talks abou.
HTML jobs
-
.NET, C#, MVC Senior Software Developer
Frontline Technologies, Inc. in Exton, United States
-
C#, JQuery, KnockoutJs. Nhibernate. Unique 3-6 month opportunity in Kitesurfing/Windsurfing heaven
RWI in Cabarete, Dominican Republic
$12,000-12,000 USD per year (Contract) -
C# / .NET Programmer
Mews Systems in Prague, Czech Republic
-
Experienced C# Developer
Zenco Systems Ltd in Rugby, United Kingdom
Annual Bonus, Annual Salary Review, Perfomance Related Bonus
Comments