以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  可不可以引用文件名做为图片的水印啊?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=55959)

--  作者:jinzhengbe
--  发布时间:2014/8/26 21:27:00
--  可不可以引用文件名做为图片的水印啊?

做项目的时候。另存图片,并且在图片上克上水印,(水印的内容就是图片的名称)可以实现么?


--  作者:有点甜
--  发布时间:2014/8/26 21:30:00
--  

 可以。参考这一章,你想画什么都可以。

 

http://www.foxtable.com/help/topics/1482.htm

 


--  作者:有点甜
--  发布时间:2014/8/26 21:44:00
--  

 参考代码

 

Dim img As Image = getimage("d:\\test.jpg")
Dim g As Graphics = Graphics.FromImage(img)
Dim fnt As New Font("宋体",16)
Dim msg As String = "I Like Foxtable"
g.DrawString(msg,fnt,Brushes.Red,10,10)
img.Save("d:\\test3.jpg")
g.Dispose()


--  作者:jinzhengbe
--  发布时间:2014/8/27 3:53:00
--  

For Each File As String In FileSys.GetFiles("C:\\图片\\")
    Dim f As Io.FileInfo =  FileSys.GetFileInfo(File)
    Dim r As Row = Tables("商品").AddNew
      r("ppp") = f.name
 
Dim d As String = Tables("商品").Current("bh")       
Dim bh As String = Format(D,"MMddhhmm") 
Dim s As String = Tables("商品").Current("cn_name")       
  Dim b As String = Tables("商品").Current("leaderid") 
  Dim c As String = Tables("商品").Current("name2") 
  Dim oo As String = Tables("商品").Current("length") 


Dim img As Image = getimage("file")
Dim g As Graphics = Graphics.FromImage(img)
Dim fnt As New Font("宋体",16)
Dim msg As String = c
g.DrawString(msg,fnt,Brushes.Red,10,10)
img.Save(file)
g.Dispose()
Next

 

 

 

1我的思路是在先找到 c:下的图片

 

2然后批量生成文件名

 

到这里我都能结局,下面的我就不会了,自己弄了半天,还是不行所以发上来了,谢谢啦~~~(没有文化,真是可怕,深刻的体会到了)

 

3 把文件名写到图片上,

 

 


--  作者:land089
--  发布时间:2014/8/27 5:33:00
--  
断点调试你的几个变量看看!
--  作者:有点甜
--  发布时间:2014/8/27 9:02:00
--  
For Each File As String In FileSys.GetFiles("C:\\图片\\")
    Dim f As Io.FileInfo =  FileSys.GetFileInfo(File)
    Dim r As Row = Tables("商品").AddNew
    r("ppp") = f.name
   
    Dim d As String = Tables("商品").Current("bh")
    Dim bh As String = Format(D,"MMddhhmm")
    Dim s As String = Tables("商品").Current("cn_name")
    Dim b As String = Tables("商品").Current("leaderid")
    Dim c As String = Tables("商品").Current("name2")
    Dim oo As String = Tables("商品").Current("length")
   
   
    Dim img As Image = getimage(file)
    Dim g As Graphics = Graphics.FromImage(img)
    Dim fnt As New Font("宋体",16)
    Dim msg As String = c
    g.DrawString(msg,fnt,Brushes.Red,10,10)
    img.Save(file)
    g.Dispose()
Next

--  作者:jinzhengbe
--  发布时间:2014/8/27 14:51:00
--  

如果我想用 cn_name做为水印的话下面的代码对么?

好像不对啊

还有想问一下,用原来的代码后 图片上显示 的 a2 ,a3 是什么意思啊?

 

For Each File As String In FileSys.GetFiles("C:\\图片\\")
    Dim f As Io.FileInfo =  FileSys.GetFileInfo(File)
    Dim r As Row = Tables("商品").AddNew
    r("ppp") = f.name
   
    Dim d As String = Tables("商品").Current("bh")
    Dim bh As String = Format(D,"MMddhhmm")
    Dim s As String = Tables("商品").Current("cn_name")
    Dim b As String = Tables("商品").Current("leaderid")
    Dim c As String = Tables("商品").Current("name2")
    Dim oo As String = Tables("商品").Current("length")
   
   
    Dim img As Image = getimage(file)
    Dim g As Graphics = Graphics.FromImage(s)
    Dim fnt As New Font("宋体",16)
    Dim msg As String = c
    g.DrawString(msg,fnt,Brushes.Red,10,10)
    img.Save(s)
    g.Dispose()
Next

 

 

 


--  作者:有点甜
--  发布时间:2014/8/27 14:52:00
--  

无语

 

For Each File As String In FileSys.GetFiles("C:\\图片\\")
    Dim f As Io.FileInfo =  FileSys.GetFileInfo(File)
    Dim r As Row = Tables("商品").AddNew
    r("ppp") = f.name
   
    Dim d As String = Tables("商品").Current("bh")
    Dim bh As String = Format(D,"MMddhhmm")
    Dim s As String = Tables("商品").Current("cn_name")
    Dim b As String = Tables("商品").Current("leaderid")
    Dim c As String = Tables("商品").Current("name2")
    Dim oo As String = Tables("商品").Current("length")
   
   
    Dim img As Image = getimage(file)
    Dim g As Graphics = Graphics.FromImage(img)
    Dim fnt As New Font("宋体",16)
    Dim msg As String = s
    g.DrawString(msg,fnt,Brushes.Red,10,10)
    img.Save(file)
    g.Dispose()
Next

 


--  作者:jinzhengbe
--  发布时间:2014/8/27 16:06:00
--  

感谢啊!!!!

在问一个问题啊?

 

坐标原点可以从右下角开始么?

 

点(Point)

一个点(Point)表示一个位置,定义一个点的语法是:

Dim 变量名 As New Point(x, y)

X表示点的水平坐标位置,y表示点的垂直位置,单位为像素,坐标原点为左上角。

区域()


--  作者:有点甜
--  发布时间:2014/8/27 16:24:00
--  
    g.DrawString(msg,fnt,Brushes.Red, img.Width - 10, Img.Height - 10)