很不错的Utility库,C#4扩展 各种功能齐全,两行代码搞定图片转字符
2012-01-05 11:44
405 查看
最近在网上发行一个挺不错的Utility库,基于C#4,部分类库可用于更低版本C#。
该库功能比较全,而且有很多很炫的功能,两行代码就能搞定图片装字符。
示例如下:
[/code]
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
效果如下
功能列表:
Utilities.DataTypes.ExtensionMethods
Array extensions
Clear
Combine
DateTime extensions
DaysInMonth
DaysLeftInMonth
DaysLeftInYear
FirstDayOfMonth
FirstDayOfWeek
FromUnixTime (actually extension for int and long values)
IsInFuture
IsInPast
IsWeekDay
IsWeekEnd
LastDayOfMonth
LastDayOfWeek
ToUnix
Generic object extensions
If
NotIf
Return
Chain
Do
Execute
ICollection extensions
AddAndReturn
AddRange
AddIf
AddIfUnique
Remove
RemoveRange
IComparable extensions
Between
IDictionary extensions
Sort
SortByValue
IEnumerable extensions
Exists
For
ForEach
ForParallel
ForEachParallel
IsNullOrEmpty
RemoveDefaults
ToArray
ToString
TrueForAll
TryAll
TryAllParallel
MatchCollection extensions
Where
string extensions
Encode
FromBase64
Left
Right
ToBase64
ToByteArray
ToFirstCharacterUpperCase
ToSentenceCapitalize
ToTitleCase
NumberTimesOccurs
Reverse
FilterOutText
KeepFilterText
AlphaNumericOnly
AlphaCharactersOnly
NumericOnly
IsUnicode
FormatString
RegexFormat
Various type conversion/type checking extensions
FormatToString
IsNotDefault
IsDefault
IsNotNull
IsNull
IsNotNullOrDBNull
IsNullOrDBNull
NullCheck
ThrowIfDefault
ThrowIfNullOrEmpty
ThrowIfNullOrDBNull
ToSQLDbType
ToDbType
ToType
TryTo
Various value type extensions
ToBool (int)
ToInt (bool)
ToBase64String (byte array)
ToEncodedString (byte array)
IsUnicode (byte array)
Utilities.IO.ExtensionMethods
Serialization extensions
ToBinary
ToJSON
ToSOAP
ToXML
ToObject
JSONToObject
SOAPToObject
XMLToObject
Uri extensions
Read
ReadBinary
Math extensions
Betweek
Clamp
Factorial
Max
Median
Min
Mode
Pow
Round
StandardDeviation
Sqrt
Variance
Permute
Utilities.SQL.ExtensionMethods
DbCommand extensions
AddParameter
BeginTransaction
ClearParameters
Close
Commit
ExecuteDataSet
ExecuteScalar
GetOutputParameter
Open
Rollback
DbDataReader extensions
GetParameter
Utilities.Compression.ExtensionMethods
Compress (both byte arrays and strings)
Decompress (both byte arrays and strings)
Utilities.Encryption.ExtensionMethods
Hash (Now handles all hash algorithms in one function for both byte arrays and strings)
Encrypt (Handles any symmetric encryption algorithm inside .Net)
Decrypt (Handles any symmetric encryption algorithm inside .Net)
Utilities.IO.ExtensionMethods
DirectoryInfo extensions
CopyTo
DeleteAll
DeleteFiles
DeleteFilesNewerThan
DeleteFilesOlderThan
Size
SetAttribute
FileInfo extensions
Append
CompareTo
Read
ReadBinary
Save
SaveAsync
SetAttributes
String extensions
RemoveIllegalDirectoryNameCharacters
RemoveIllegalFileNameCharacters
Utilities.Web.ExtensionMethods
Web related extensions
AbsoluteRoot
AddScriptFile
ContainsHTML
HTTPCompress
IsEncodingAccepted
RelativeRoot
RemoveURLIllegalCharacters
SetEncoding
StripHTML
IPAddress extensions
GetHostName
Minification
Combine (can be used for HTML,JavaScript, or CSS)
Minify (can be used for HTML, JavaScript, or CSS)
HttpRequest extensions
IsMobile
Utilities.Image.ExtensionMethods
All Bitmap functions were moved
Added ToBase64 extension method
Added DrawRoundedRectangle extension
Screen extensions
TakeScreenShot
Utilities.Error.ExtensionMethods
Various error related extensions
DumpApplicationState
DumpCache
DumpCookies
DumpRequestVariable
DumpResponseVariable
DumpServerVars
DumpSession
Utilities.Reflection.ExtensionMethods
Various reflection related extensions
CallMethod
CreateInstance
DumpProperties
GetAttribute
GetAttributes
GetName
GetObjects
GetProperty
GetPropertyGetter
GetPropertyName
GetPropertyType
GetPropertySetter
GetTypes
IsIEnumerable
IsOfType
Load
LoadAssemblies
MarkedWith
MakeShallowCopy
SetProperty
ToLongVersionString
ToShortVersionString
Utilities.Environment.ExtensionMethods
Process related extensions
KillProcessAsync
GetInformation
On top of that there are a number of helper classes for a number of various tasks including (note that there are actually more, this is what I can remember off the top of my head):
Email
Pop3 client (SSL capable)
MIME parser
SMTP email sending (SSL capable)
Exchange inbox email retrieval
Image manipulation (one of the larger collections of functions dealing in image manipulation out there)
Cropping, resizing, rotating, flipping
To black and white or sepia tone
Threshold and edge detection (including Sobel and Laplace)
Text drawing, watermarks, object drawing helpers
Taking a screenshot which spans monitors
RGB Histograms
Various convolution filters such as sharpen, sobel emboss, etc. along with the ability to create your own easily.
Various other filters such as "jitter", pixelate, sin wave, median filter, and dilation, red/green/blue filters,
Multiple blurring techniques including box blur, Gaussian blur, Kuwahara, and Symmetric Nearest Neighbor blur
Bump map and Normal map helpers
ASCII art generator
Adjust brightness, gamma, and contrast
Active Directory querying
Includes functions for active users, all users, all groups, active members in groups, etc.
Exchange querying
Free/Busy data
Get next/previous available time for appointments
Get contacts
Get appointments/events
Get emails
Get the GAL
SQL query helper
MicroORM
ORM (which includes lazy loading, etc.)
SQL Server structural analysis helpers
File formats/Microformats
XMDP
RSS (with iTunes/Zune information embedded for podcasts)
vCard/hCard
vCalendar/hCalendar
iCalendar (with email sending capabilities, cancellation, and automatically putting it in Exchange)
APML
OPML
XFN
CSV
RSD
BlogML
INI
Cisco phone app helpers
WMI query helpers
Code to render a web page to BMP file
Icon extraction from a file
WebBrowser control cache clearing class
Helper classes for simplifying System.Reflection.Emit namespace
Randomization
Including string randomization based on allowable characters, date randomization, Color, Enum, TimeSpan, and Lorem Ipsum generation.
Environment information
Process management
Error/Information gathering
Math related classes
Matrix
Vector3
Set
Factorial
Permutation
Data types
Vector
Bag
List
ListMapping
Priority Queue
BTree
Base classes for various patterns including
Singleton
Factory
OAuth helper class
Code for setting up an OpenID relay
REST helper class
Classes to help with various media services/websites including
Twitter
Hulu
Netflix
Craigslist
eBay
Naive Bayes classifier
Validation classes
Caching helper classes
Logging helper classes
Configuration helper classes
AOP helper classes
喜爱的码农们,走过路过可不要错过了。
最后是传送门
搓
该库功能比较全,而且有很多很炫的功能,两行代码就能搞定图片装字符。
示例如下:
using (Bitmap TestObject = new Bitmap(@"..\..\Data\Image\Lenna.jpg"))
[code]{
string Value = Utilities.Media.Image.ASCIIArt.ConvertToASCII(TestObject);
}
[/code]
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
效果如下
功能列表:
Utilities.DataTypes.ExtensionMethods
Array extensions
Clear
Combine
DateTime extensions
DaysInMonth
DaysLeftInMonth
DaysLeftInYear
FirstDayOfMonth
FirstDayOfWeek
FromUnixTime (actually extension for int and long values)
IsInFuture
IsInPast
IsWeekDay
IsWeekEnd
LastDayOfMonth
LastDayOfWeek
ToUnix
Generic object extensions
If
NotIf
Return
Chain
Do
Execute
ICollection extensions
AddAndReturn
AddRange
AddIf
AddIfUnique
Remove
RemoveRange
IComparable extensions
Between
IDictionary extensions
Sort
SortByValue
IEnumerable extensions
Exists
For
ForEach
ForParallel
ForEachParallel
IsNullOrEmpty
RemoveDefaults
ToArray
ToString
TrueForAll
TryAll
TryAllParallel
MatchCollection extensions
Where
string extensions
Encode
FromBase64
Left
Right
ToBase64
ToByteArray
ToFirstCharacterUpperCase
ToSentenceCapitalize
ToTitleCase
NumberTimesOccurs
Reverse
FilterOutText
KeepFilterText
AlphaNumericOnly
AlphaCharactersOnly
NumericOnly
IsUnicode
FormatString
RegexFormat
Various type conversion/type checking extensions
FormatToString
IsNotDefault
IsDefault
IsNotNull
IsNull
IsNotNullOrDBNull
IsNullOrDBNull
NullCheck
ThrowIfDefault
ThrowIfNullOrEmpty
ThrowIfNullOrDBNull
ToSQLDbType
ToDbType
ToType
TryTo
Various value type extensions
ToBool (int)
ToInt (bool)
ToBase64String (byte array)
ToEncodedString (byte array)
IsUnicode (byte array)
Utilities.IO.ExtensionMethods
Serialization extensions
ToBinary
ToJSON
ToSOAP
ToXML
ToObject
JSONToObject
SOAPToObject
XMLToObject
Uri extensions
Read
ReadBinary
Math extensions
Betweek
Clamp
Factorial
Max
Median
Min
Mode
Pow
Round
StandardDeviation
Sqrt
Variance
Permute
Utilities.SQL.ExtensionMethods
DbCommand extensions
AddParameter
BeginTransaction
ClearParameters
Close
Commit
ExecuteDataSet
ExecuteScalar
GetOutputParameter
Open
Rollback
DbDataReader extensions
GetParameter
Utilities.Compression.ExtensionMethods
Compress (both byte arrays and strings)
Decompress (both byte arrays and strings)
Utilities.Encryption.ExtensionMethods
Hash (Now handles all hash algorithms in one function for both byte arrays and strings)
Encrypt (Handles any symmetric encryption algorithm inside .Net)
Decrypt (Handles any symmetric encryption algorithm inside .Net)
Utilities.IO.ExtensionMethods
DirectoryInfo extensions
CopyTo
DeleteAll
DeleteFiles
DeleteFilesNewerThan
DeleteFilesOlderThan
Size
SetAttribute
FileInfo extensions
Append
CompareTo
Read
ReadBinary
Save
SaveAsync
SetAttributes
String extensions
RemoveIllegalDirectoryNameCharacters
RemoveIllegalFileNameCharacters
Utilities.Web.ExtensionMethods
Web related extensions
AbsoluteRoot
AddScriptFile
ContainsHTML
HTTPCompress
IsEncodingAccepted
RelativeRoot
RemoveURLIllegalCharacters
SetEncoding
StripHTML
IPAddress extensions
GetHostName
Minification
Combine (can be used for HTML,JavaScript, or CSS)
Minify (can be used for HTML, JavaScript, or CSS)
HttpRequest extensions
IsMobile
Utilities.Image.ExtensionMethods
All Bitmap functions were moved
Added ToBase64 extension method
Added DrawRoundedRectangle extension
Screen extensions
TakeScreenShot
Utilities.Error.ExtensionMethods
Various error related extensions
DumpApplicationState
DumpCache
DumpCookies
DumpRequestVariable
DumpResponseVariable
DumpServerVars
DumpSession
Utilities.Reflection.ExtensionMethods
Various reflection related extensions
CallMethod
CreateInstance
DumpProperties
GetAttribute
GetAttributes
GetName
GetObjects
GetProperty
GetPropertyGetter
GetPropertyName
GetPropertyType
GetPropertySetter
GetTypes
IsIEnumerable
IsOfType
Load
LoadAssemblies
MarkedWith
MakeShallowCopy
SetProperty
ToLongVersionString
ToShortVersionString
Utilities.Environment.ExtensionMethods
Process related extensions
KillProcessAsync
GetInformation
On top of that there are a number of helper classes for a number of various tasks including (note that there are actually more, this is what I can remember off the top of my head):
Pop3 client (SSL capable)
MIME parser
SMTP email sending (SSL capable)
Exchange inbox email retrieval
Image manipulation (one of the larger collections of functions dealing in image manipulation out there)
Cropping, resizing, rotating, flipping
To black and white or sepia tone
Threshold and edge detection (including Sobel and Laplace)
Text drawing, watermarks, object drawing helpers
Taking a screenshot which spans monitors
RGB Histograms
Various convolution filters such as sharpen, sobel emboss, etc. along with the ability to create your own easily.
Various other filters such as "jitter", pixelate, sin wave, median filter, and dilation, red/green/blue filters,
Multiple blurring techniques including box blur, Gaussian blur, Kuwahara, and Symmetric Nearest Neighbor blur
Bump map and Normal map helpers
ASCII art generator
Adjust brightness, gamma, and contrast
Active Directory querying
Includes functions for active users, all users, all groups, active members in groups, etc.
Exchange querying
Free/Busy data
Get next/previous available time for appointments
Get contacts
Get appointments/events
Get emails
Get the GAL
SQL query helper
MicroORM
ORM (which includes lazy loading, etc.)
SQL Server structural analysis helpers
File formats/Microformats
XMDP
RSS (with iTunes/Zune information embedded for podcasts)
vCard/hCard
vCalendar/hCalendar
iCalendar (with email sending capabilities, cancellation, and automatically putting it in Exchange)
APML
OPML
XFN
CSV
RSD
BlogML
INI
Cisco phone app helpers
WMI query helpers
Code to render a web page to BMP file
Icon extraction from a file
WebBrowser control cache clearing class
Helper classes for simplifying System.Reflection.Emit namespace
Randomization
Including string randomization based on allowable characters, date randomization, Color, Enum, TimeSpan, and Lorem Ipsum generation.
Environment information
Process management
Error/Information gathering
Math related classes
Matrix
Vector3
Set
Factorial
Permutation
Data types
Vector
Bag
List
ListMapping
Priority Queue
BTree
Base classes for various patterns including
Singleton
Factory
OAuth helper class
Code for setting up an OpenID relay
REST helper class
Classes to help with various media services/websites including
Hulu
Netflix
Craigslist
eBay
Naive Bayes classifier
Validation classes
Caching helper classes
Logging helper classes
Configuration helper classes
AOP helper classes
喜爱的码农们,走过路过可不要错过了。
最后是传送门
搓
相关文章推荐
- 很不错的Utility库,C#4扩展 各种功能齐全,两行代码搞定图片转字符
- C# 改变图片大小的功能代码片段 (wince5)
- 两行代码搞定MFC清屏功能
- c# .net中如何实现图片防盗链功能的代码实例
- Azure 认知服务 (5) 计算机视觉API - 使用C#代码实现读取图片中的文字(OCR)功能
- 网络爬虫,用C#做一个网络爬虫demo,功能有保存网页、图片、js文件、等等其他的文件。有界面显示,有代码注释。
- 扩展一下FCK HtmlEditor 增加图片上传、代码插入功能
- C#代码--将图片转为字符流并再重新生成
- 关于c#代码Convert.ToChar(null);出现异常,而object obj = null; Convert.ToChar(obj);//返回'\0'空字符问题详解
- 两句代码搞定发送短信(smsManager)的功能
- C#.NET WebApi返回各种类型(图片/json数据/字符串),.net图片转二进制流或byte
- Android GridView扩展仿微信微博发图动态添加删除图片功能
- asp图片加水印的功能代码
- 功能齐全界面漂亮的c#音乐播放器
- 三行代码接入,社交软件打字时底下弹出的表情布局,自定义ViewPager+页面点标+各种功能的android小框架。
- 给CuteEditor5增加了高亮代码显示功能(C#版)
- 用C#实现屏幕吸色功能,附逻辑思维讲解图,功能代码不超过50行即可实现
- 史上最全的CSS hack方式一览 jQuery 图片轮播的代码分离 JQuery中的动画 C#中Trim()、TrimStart()、TrimEnd()的用法 marquee 标签的使用详情 js鼠标事件 js添加遮罩层 页面上通过地址栏传值时出现乱码的两种解决方法 ref和out的区别在c#中 总结
- C#获取图片扩展名