① 请问aspimage的详细使用方法
使用ASPImage组件仅需以下步骤:
建一个对象
设置若干属性
调用SaveImage方法
以下代码举例说明如何在vbscript中使用ASPImage组件,在这个例子中我们要建立一个渐进填充的字样为 "welcome to"的文字图片:
Set Image = Server.CreateObject("AspImage.Image")
rem Set various font parameters
Image.FontColor = vbBlack
Image.Italic = True
Image.Bold = True
Image.FontName = "Arial"
Image.FontSize = 12
Image.PadSize = 10
rem Calculate how big our text info is and set the image to this size
rem This has to be done since we want to fill the area with a gradient
strMessage = "Welcome to"
Image.MaxX = Image.TextWidth (strMessage)
Image.MaxY = Image.TextHeight (strMessage)
rem Create a one way gradient
Image.GradientOneWay vbRed, vbWhite, 0
rem Print our string to the image
Image.TextOut strMessage, Image.X, Image.Y, false
rem Set the filename and save
rem NOTE: You should gen the filename dynamically for multiuser usage
Image.FileName = "d:\inetpub\wwwroot\images\msg1.jpg"
if Image.SaveImage then
rem The image was saved so write the <img src> tag out for the browser to pick up
Response.Write "<img src=""/images/msg1.jpg""><br>"
else
rem Something happened and we couldn't save the image so just use an HTML header
rem We need to debug the script and find out what went wrong
Response.Write "<h2>Welcome to</h2>
end if
通过使用SaveImage方法我们可以得知图片是否已经正确保存了。一般导致图片不能正确保存的原因是图片的保存路径不合法或者对该路径没有写的权限。
GIF Animations
图片能被加载或进行处理,并且可以通过调用AddImage方法将这些修改保存到一个活动顺序的动画中。在soianim.asp中有个简单的GIF动画例子,这个文件已打包到ASPImage的ZIP文件中。
② 求java中Image类的使用,最好能有几个简单的例子,不要给我什么帮助文档啊,我自己有帮助文档。
这个是生成随即图片验证码的例子
package org.web.servlet;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class RandomCode extends HttpServlet {
/**
*
*/
private static final long serialVersionUID = -8636059798367365083L;
public static final String RANDOMCODE = "RANDOMCODE";//session定义
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "No-cache");
response.setDateHeader("Expires", 0);
int width = 80, height = 23;
BufferedImage img = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Random random = new Random();
Graphics g = img.getGraphics();
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height);
// 设定字体
g.setFont(new Font("Verdana", Font.ITALIC + Font.PLAIN, 18));
// 设定随机字体
//设置背景颜色
//g.setColor(new Color(random.nextInt(250),random.nextInt(250),random.nextInt(250)));
// 画边框
g.setColor(new Color(33, 66, 99));
g.drawRect(0, 0, width - 1, height - 1);
// 随机产生50条干扰线,使图象中的认证码不易被其它程序探测到
//g.setColor(getRandColor(100, 150));
g.setColor(new Color(200,200,200));
for (int i = 0; i < 50; i++) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x, y, x + xl, y + yl);
}
String[] randStr = {"0","1","2","3","4","5","6","7","8","9",
"A","B","C","D","E","F","G","H","I","J","K",
"L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
// 取随机产生的认证码(6位数字)
String sRand = "";
for (int i = 0; i < 5; i++) {
String rand = String.valueOf(randStr[random.nextInt(randStr.length-1)]);
sRand += rand;
// 将认证码显示到图象中
// 设置字体颜色
//g.setColor(this.getRandColor(40, 60));
g.setColor(new Color(random.nextInt(100),random.nextInt(100),random.nextInt(100)));
g.drawString(rand, 13 * i + 6, 16);
}
// 将认证码存入SESSION
HttpSession session = request.getSession();
session.setAttribute(RandomCode.RANDOMCODE, sRand);
// 释放图形上下文
g.dispose();
// 输出图象到页面
ImageIO.write(img, "JPEG", response.getOutputStream());
}
private Color getRandColor(int fc, int bc) {
Random random = new Random();
if (fc > 255) {
fc = 255;
}
if (bc > 255) {
bc = 255;
}
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
}
}
③ 第三节 Flutter Image图片组件的使用
Image组件的构造方法
在 Android 中,我们都知道,图片的显示方式有很多,资源图片、网络图片、文件图片等等,在 Flutter 中也有多种方式,用来加载不同形式的图片:
Image:通过ImageProvider来加载图片
Image.asset:用来加载本地资源图片
Image.file:用来加载本地(File文件)图片
Image.network:用来加载网络图片
Image.memory:用来加载Uint8List资源(byte数组)图片
Image 的一个参数是 ImageProvider,基本上所有形式的图片加载都是依赖它,这个类里面就是实现图片加载的原理。用法如下:
加载一个本地资源图片,和 Android 一样,有多种分辨率的图片可供选择,但是沿袭的是 iOS 的图片风格,分为 1x,2x,3x,具体做法是在项目的根目录下创建两个文件夹,如下图所示:
还要配置如下
在pubspec.yaml文件
加载一个本地 File 图片,比如相册中的图片,用法如下
加载一个网络图片,用法如下:
有的时候我们需要像Android那样使用一个占位图或者图片加载出错时显示某张特定的图片,这时候需要用到 FadeInImage 这个组件:
用来将一个 byte 数组加载成图片,用法如下:
④ delphi中image的使用方法
你可以这样:
Image1.Picture.LoadFromFile('d:\aa.bmp');
一般设计程序时候,从规范上考虑,也为安装方便,一般把程序调用的资源(如图片\动画\视频)等放到程序相同的目录,然后调用.
比如你把图片放到和程序执行同目录下的res文件夹中,可如下调用:
Image1.Picture.LoadFromFile(ExtractFilePath(paramstr(0))+'res\aa.bmp');
⑤ 关于java里image的用法
先要设置图片路径,我们将一将背景图片back.jpg放到C盘的img目录下,调用语句如下:
ImageIcon icon=new ImageIcon("C:\\img\\back.jpg),一定要是双反斜杠
然后分别在JComponent里添加图片
JFrame
利用JFrame的一个方法setIconImage(Image image);
由于要用到Image类,所以还得把上面定义的ImageIcon对象转换成Image对象:
Image image=icon.getImage();
然后就可以调用JFrame的setIconImage(image)方法了。
还要注意一点的是,由于有些图片的格式JVM不能识别,所以要转格式,一般为jpg,gif.如把.bmp格式的转换为.jpg,不能简单的把后缀名改了就行,这样照样不能显示。方法很简单,直接用WINDOWS自带的画图工具打开图片,然后另存为时改为.jpg或.gif格式就可以了。
附源代码
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.JTree;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import java.awt.FlowLayout;
public class ImageTest extends JFrame{
ImageIcon icon=new ImageIcon("c:\\img\\system.jpg");
Image image=icon.getImage();
public ImageTest()
{
JMenuBar mb=new JMenuBar();
this.setJMenuBar(mb);
JMenu menu=new JMenu("system");
menu.setIcon(icon);
//JMenuItem item=new JMenuItem("exit",icon);
JMenuItem item=new JMenuItem(icon);
item.setIcon(icon);
JLabel label=new JLabel(icon);
//label.setIcon(icon);
menu.add(item);
mb.add(menu);
DefaultMutableTreeNode root=new DefaultMutableTreeNode();
DefaultMutableTreeNode node1=new DefaultMutableTreeNode();
DefaultMutableTreeNode node11=new DefaultMutableTreeNode();
DefaultMutableTreeNode node12=new DefaultMutableTreeNode();
DefaultMutableTreeNode node2=new DefaultMutableTreeNode();
DefaultMutableTreeNode node21=new DefaultMutableTreeNode();
root.add(node1);
root.add(node2);
node1.add(node11);
node1.add(node12);
node2.add(node21);
JTree jTree1 = new javax.swing.JTree(root);
DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
renderer.setOpenIcon(new ImageIcon("C:\\img\\down.jpg")); //展开时节点图标
renderer.setClosedIcon(new ImageIcon("C:\\img\\file.jpg")); //折叠时节点图标
renderer.setLeafIcon(new ImageIcon("C:\\img\\man_small.jpg")); //叶子节点图标
jTree1.setCellRenderer(renderer);
this.add(label);
this.setIconImage(image);
this.add(jTree1);
this.setDefaultCloseOperation(3);
this.setLocation(300,400);
this.pack();
this.setVisible(true);
}
public static void main(String[] args)
{
new ImageTest();
}
}
⑥ silverlight,中的图片对象Image 的使用方法
Silverlight2 beta2现在支持的Image格式有jpg和png,部分png编码也不支持,同时有些png在xaml的design预览中不可见,但运行时可见。请看XAML markup中两行代码的异同:
<Image x:Name="img" Source="test.jpg" /><Image x:Name="img2" Source="/test2.jpg" />反斜杠forward-slash?有没有虾米区别呢?建立一个名称为pan的Silverlight应用程序工程,解决方案资源管理器如图所示。第一种方式(不以反斜杠开头)的图片test.jpg应该放在pan目录下才可正确引用,而第二种方式,图片test2.jpg必需放在ClientBin目录下,否则会发生ImageError。
为什么呢?反斜杠开头说明该URI是一个相对路径,而程序运行时的根目录为ClientBin,因此test2.jpg的位置应该调整。不过此时在XAML的design预览试中看不到test2.jpg图片。如果图片一样,那么运行结果是相同。如此一来,究竟选择哪种方式呢?分别把两种方式的xap文件重命名为zip,解压之,并用reflector反编译其中的dll文件,可以看到第一种方式(没有/)resource里包含了test图片,而第二种方式resource里却没有test2图片。由此可知,第一种方式把图片嵌入到Silverlight程序中直接下载到客户端,而第二种方式则按需索取(on-demand),当显示时再去下载。当数据量较大时,第一种方式加载程序的时间就过长,用户体验不好。而第二种方式优势就比较明显,只不过在xaml设计时预览不方便,此时可以先把需要显示的图片除了放在ClientBin目录下外,亦可先复制一份放在pan目录下供设计使用,程序发布时再删除。+++++++++++++++++++++++他们都说我是分割线+++++++++++++++++++++++++++++
事实上,不止是图片,音频、视频,甚至XML和XAML等non-executable data files都是resource文件,处理方式类似。若深究,则资源文件可细分为Resource files 、Content files 、Site of origin files,可参考Silverlight Documentation的相关章节。参考下面的Silverlight Application组成,LionGG简单讲解下。
⑦ 求助Matlab的image和imagesc的用法
image函数是显示图像的最基本的方法。该函数还产生了图像对象的句柄,并允许对对象的属性进行设置。
imshow函数比image和imagesc更常用,它能自动设置句柄图像的各种属性。imshow可用于显示各类图像。对于每类图像,调用方法如下:
• imshow filename:显示图像文件。
• imshow(BW):显示二值图像,BW为黑白二值图像矩阵。
• imshow(X,map):显示索引图像,X为索引图像矩阵,map为色彩图示。
• imshow(I):显示灰度图像,I为二值图像矩阵。
• imshow(RGB):显示RGB图像,RGB为RGB图像矩阵。
• imshow(I,[low high]):将非图像数据显示为图像,这需要考虑数据是否超出了所显示类型的最大允许范围,其中[low high]用于定义待显示数据的范围。imshow(I, [])自动调节数据范围以便于显示。
imagesc函数也具有image的功能,所不同的是imagesc函数还自动将输入数据比例化,以全色图的方式显示。imagesc会对图像灰度级做缩放处理,imshow不会缩放。
imagesc(A)将矩阵A中的元素数值按大小转化为不同颜色,并在坐标轴对应位置处以这种颜色染色。
imagesc(x,y,A) x, y分别为二维向量,Matlab会在[x1,x2]*[y1,y2]范围内染色。
⑧ delphi中的IMAGE控件的用法
从路径读取图片并显示: Image1.Picture.LoadFromFile('E:\My Pictures\01.bmp');清除图片: Image1.Picture.Assign(nil);更改图片: Image1.Picture.LoadFromFile('E:\My Pictures\01.bmp'); //一样的方法属性: Center:居中 Seretch:缩小并填充 Proportional: 按比例缩小
⑨ vb image用法
image读取:
Image1.Picture = LoadPicture(App.Path & "\1.jpg")
1.JPG在当前程序所在目录,或
Image1.Picture = LoadPicture("C:\ABC\1.jpg")
1.JPG在“C:\ABC”的目录中
如果图片是提前不知道,需要变量控制:
DIM A AS STRING
A=TEXT1.TEXT
Image1.Picture = LoadPicture(App.Path & "/" & A & "")
TEXT1.TEXT中输入当前目录中的图片名称+扩展名
⑩ image的例句与用法
1. How can we improve our image?
我们该怎样来改善自己的形象呢?
2. Her image rose before him.
她的影像在他眼前浮现。
3. I have this image of you as always being cheerful.
在我的心目中,你的样子总是兴高采烈的。
4. According to the Bible, God created man in his image.
据《圣经》所叙, 上帝按自己的形象创造了人.
5. She's the (spitting) image of her mother.
她长得活像她妈妈.
6. They concentrated on better definition of the optical image.
他们致力于提高该光学影像的鲜明度.
7. She is the express image of her mother.
她和她母亲长得一模一样。
8. This company is concerned about its corporate image.
这家公司关心它自身的法人形象。