截图您上传的图片不是原图算不算原图?

截屏应注意的细节和尝试(导出的图片一片黑色)
1.在手机的图片查看器是没有颜色背景的(没有黑色就显示为黑色)。而画笔的颜色是默认黑色的,所以需要一个非黑色的背景才能够看到黑色的字体。
下面是截屏的关键代码:是从顶层View绘制,所以contentView为根的子控件树不加背景也是可以看到黑色字体的,因为顶层View应该是绘制了白色背景的
static Bitmap getListViewScreenShot(Activity a){
View view = a.getWindow().getDecorView();
/*view.setDrawingCacheEnabled(true);
view.buildDrawingCache();
Bitmap b1 = view.getDrawingCache();*/
Canvas canvas = new Canvas();
Bitmap b1 = Bitmap.createBitmap(720, 1200, Bitmap.Config.ARGB_8888);
canvas.setBitmap(b1);
view.draw(canvas);
Rect frame = new Rect();
a.getWindow().getDecorView().getWindowVisibleDisplayFrame(frame);
int statusBarHeight = frame.
System.out.println(statusBarHeight);
int width = a.getWindowManager().getDefaultDisplay().getWidth();
int height = a.getWindowManager().getDefaultDisplay()
.getHeight();
// Bitmap b = Bitmap.createBitmap(b1, 0, 25, 320, 455);
Bitmap b = Bitmap.createBitmap(b1, 0, statusBarHeight, width, height
- statusBarHeight);
view.destroyDrawingCache();
public static void savePic(Bitmap b, String strFileName) {
FileOutputStream fos =
fos = new FileOutputStream(strFileName);
if (null != fos) {
final boolean isSuccessCompress = b.compress(Bitmap.CompressFormat.PNG, 90, fos);
if(isSuccessCompress){
Log.e("isSuccessCompress", "yyyyyyyy");
Log.e("isSuccessCompress", "NNNNNNNN");
fos.flush();
fos.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
public static void shootLoacleView(Activity a,String picpath) {
savePic(getListViewScreenShot(a), picpath);
而不是从顶层View开始绘制的(即不是调用decorView.draw(canvas)),而是从控件树的其他View开始绘制的,就要给该View绘制个背景canvas.drawColor(Color.WHITE),如果要看到绘制的黑色字体的话
public static Bitmap getListViewBitmap(ListView listView,String picpath) {
int h = 0;
int w = 0;
int count = listView.getChildCount();
for (int i = 0; i & i++) {
h += listView.getChildAt(i).getHeight();
w = listView.getWidth();
bitmap = Bitmap.createBitmap(w, h,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas();
canvas.setBitmap(bitmap);
canvas.drawColor(Color.WHITE);
View view = (View)listV
view.draw(canvas);
public static void shootListView(ListView listView, String picpath) {
savePic(getListViewBitmap(listView,picpath), picpath);
public static Bitmap getScrollViewBitmap(ScrollView scrollView,String picpath) {
int h = 0;
// 获取listView实际高度
for (int i = 0; i & scrollView.getChildCount(); i++) {
h += scrollView.getChildAt(i).getHeight();
Log.d(TAG, "" + h);
Log.d(TAG, " 高度:" + scrollView.getHeight());
// 创建对应大小的bitmap
bitmap = Bitmap.createBitmap(scrollView.getWidth(), h,
Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(bitmap);
canvas.drawColor(Color.WHITE);
scrollView.draw(canvas);
/* // 测试输出
FileOutputStream out =
out = new FileOutputStream(picpath);
} catch (FileNotFoundException e) {
e.printStackTrace();
if (null != out) {
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
out.close();
} catch (IOException e) {
static Bitmap getTextViewBitmap(TextView tv){
tv.setDrawingCacheEnabled(true); tv.buildDrawingCache(); Bitmap b1 = tv.getDrawingCache(); return b1; }
static void shootTextView(TextView tv, String picPath){
savePic(getTextViewBitmap(tv), picPath); }
private static String TAG = "Listview and ScrollView item 截图:";
public static void shootScrollView(ScrollView scrollView, String picpath) {
savePic(getScrollViewBitmap(scrollView, picpath), picpath); }
/*注意:上面是的ScrollVIew和ListView的截屏的目的是长截屏,就是没有显示出来 的部分都要截取出来。但是ListView做不到,因为ListView为了效率,把没有显示出来的不绘制,所以只能截取到ListView中显示出来的Item。而ScrollVIew没有作这个处理。*/
没有更多推荐了,
加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!QQ截图:如果保存的话默认格式是PNG的,在保存的时候可以自己选择格式,如JPG,BMP或GIF。如果是QQ影音截取的动态图,一般都是GIF格式的你截图被别人用了算盗图吗? - 知乎有问题,上知乎。知乎作为中文互联网最大的知识分享平台,以「知识连接一切」为愿景,致力于构建一个人人都可以便捷接入的知识分享网络,让人们便捷地与世界分享知识、经验和见解,发现更大的世界。3被浏览710分享邀请回答0添加评论分享收藏感谢收起先锋游戏知道信息频道欢迎您
多媒体:能找到这张图片的原图吗?这是截图,要原图。谢谢!
[Y] [ 17:18:34] (<span id="tgd) (<span id="tfd) &&
问题详情最佳答案望采纳 !谢谢!其他答案你复制 百度搜图片
昵称: 验证码:
评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述
多媒体相关知识
多媒体其他问题截屏的图片算不算原图?_百度知道
截屏的图片算不算原图?
我有更好的答案
严格意义上说不算是,不同的截屏软件截出来的图片像素清晰度都可能是不同的,也依赖于自己电脑的显示像素,与原图会有差别。但是不严格要求这些的话,截出来的图片和你需要的看起来差不多,就满足你的要求了。
采纳率:70%
为您推荐:
其他类似问题
&#xe675;换一换
回答问题,赢新手礼包&#xe6b9;
个人、企业类
违法有害信息,请在下方选择后提交
色情、暴力
我们会通过消息、邮箱等方式尽快将举报结果通知您。

我要回帖

更多关于 截图有办法成原图吗 的文章

 

随机推荐