#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib") using namespace std;
using namespace Gdiplus; int main()
{
GdiplusStartupInput gdiplusstartupinput;
ULONG_PTR gdiplustoken;
GdiplusStartup(&gdiplustoken, &gdiplusstartupinput, nullptr); wstring infilename(L"1.jpg");
string outfilename("color.txt");
//读图片
Bitmap* bmp = new Bitmap(infilename.c_str());
UINT height = bmp->GetHeight();
UINT width = bmp->GetWidth();
cout << "width " << width << ", height " << height << endl; Color color;
ofstream fout(outfilename.c_str()); for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
{
bmp->GetPixel(x, y, &color);
fout << x << ";" << y << ";"
<< (int)color.GetRed() << ";"
<< (int)color.GetGreen() << ";"
<< (int)color.GetBlue() << endl;
} fout.close(); delete bmp;
GdiplusShutdown(gdiplustoken);
return 0;
}

  

C++获取得到图片的坐标和rgb的更多相关文章

  1. Java 获取Word中指定图片的坐标位置

    本文介绍通过Java程序获取Word文档中指定图片的坐标位置. 程序运行环境: Word测试文档:.docx 2013 Free Spire.doc.jar 3.9.0 IntelliJ IDEA J ...

  2. 用Delphi直接获取bmp图片的像素

    用Delphi直接获取bmp图片的像素,并存储显示出.(此像素主要用在LED上显示).希望高手能给出代码啊!! function getImagePixels(f: string): Integer; ...

  3. Android绘图机制(二)——自定义View绘制形, 圆形, 三角形, 扇形, 椭圆, 曲线,文字和图片的坐标讲解

    Android绘图机制(二)--自定义View绘制形, 圆形, 三角形, 扇形, 椭圆, 曲线,文字和图片的坐标讲解 我们要想画好一些炫酷的View,首先我们得知道怎么去画一些基础的图案,比如矩形,圆 ...

  4. php正则获取html图片标签信息(采集图片)

    php获取html图片标签信息(采集图片),实现图片采集及其他功能,带代码如下: <?php $str="<img src='./a.jpg'/>111111<img ...

  5. android获取本地图片并显示图片

    import java.io.FileNotFoundException; import android.content.ContentResolver; import android.content ...

  6. wordpress 获取特色图片url方法

    制作主题是需要获取特色图片,直接获取到url能更好的编辑css样式 <?php $large_image_url = wp_get_attachment_image_src( get_post_ ...

  7. curl获取远程图片存到本地

    $url = 'http://sssss/sss/xu0fLo9waqKSTDO7j0kSO41O5Luq3LB6ozUvY4O7OsXUWNicB49fBs8nGYzoqcwGDARQZHpVuic ...

  8. php 获取远程图片保存到本地

    php 获取远程图片保存到本地 使用两个函数 1.获取远程文件 2.把图片保存到本地 /** * 获取远程图片并把它保存到本地 * $url 是远程图片的完整URL地址,不能为空. */ functi ...

  9. JS获取IMG图片高宽

    前段时间在LJW写的touchslider.js轮播代码里添加自适应屏幕大小的功能时,遇到一个问题.不管用什么样的方法都无法获取到IMG标签的高宽,最后只有给图片定一个高宽的比例值:趁今天有空我就写了 ...

随机推荐

  1. 异步任务神器 Celery 简明笔记

    转自:http://www.jianshu.com/p/1840035cb510 异步任务 异步任务是web开发中一个很常见的方法.对于一些耗时耗资源的操作,往往从主应用中隔离,通过异步的方式执行.简 ...

  2. esriSRProjCS2Type Constants

    ArcGIS Developer Help  (Geometry)   esriSRProjCS2Type Constants See Also esriSRProjCSType Constants ...

  3. (easy)LeetCode 242.Valid Anagram

    Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = &q ...

  4. [POJ 3211] Washing Clothes (动态规划)

    题目链接:http://poj.org/problem?id=3211 题意:有M件衣服,每种衣服有一种颜色,一共有N种颜色.现在两个人洗衣服,规则是必须把这一种颜色的衣服全部洗完才能去洗下一种颜色的 ...

  5. Antlr学习

    参加工作之后,接触DSL领域语言,了解了编译原理. 比如Hibernate.Hive等的HQL都是基于antlr编写的 所以,如果想自己实现一套DSL语言,我们可以基于antlr做词法分析与语法分析 ...

  6. Sqool与kettle开源的ETL工具

    现在的ETL都是基于管道的模式(数据流)运行,比较有名的有 TaskCTL ========================================== 数据抽取的开源工具 一个是RDBMS ...

  7. 1314: ZZY的困惑

    1314: ZZY的困惑 Time Limit: 2 Sec  Memory Limit: 128 M[Submit][Status][Web Board] Description ZZY有很多爱好~ ...

  8. CSS3 border-radius 属性和CSS outline 属性

    CSS3 border-radius 属性 border-radius 属性是一个简写属性,用于设置四个 border-*-radius 属性. 提示:该属性允许为元素添加圆角边框! 注释:按此顺序设 ...

  9. [转]windows下设置socket的connect超时

    原文地址:http://www.cnblogs.com/BloodAndBone/archive/2012/05/22/2513338.html 变相的实现connect的超时,我要讲的就是这个方法, ...

  10. struts2下实现的json传递list,object。

    必须的jar: java bean: package upload.progress.action; public class music { private String name; private ...