#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. redis命令(转)

    http://redis.readthedocs.org/en/latest/index.html 连接操作相关的命令 quit:关闭连接(connection) auth:简单密码认证 持久化 sa ...

  2. [ActionScript 3.0] Away3D 天空盒(skybox)例子2

    所谓skybox就是六个面即六张图能够无缝的拼成一个正方体的盒子. package { import away3d.cameras.Camera3D; import away3d.cameras.le ...

  3. html——SVG

    SVG 指可伸缩矢量图形 (Scalable Vector Graphics) SVG 用于定义用于网络的基于矢量的图形 SVG 使用 XML 格式定义图形 SVG 图像在放大或改变尺寸的情况下其图形 ...

  4. Codeforces Round #223 (Div. 2) C

    C. Sereja and Prefixes time limit per test 1 second memory limit per test 256 megabytes input standa ...

  5. 中南大学第一届长沙地区程序设计邀请赛 New Sorting Algorithm

    1352: New Sorting Algorithm Time Limit: 1 Sec  Memory Limit: 128 MB Description We are trying to use ...

  6. windows 开机启动(为了关闭虚拟机的那么多开机进程)

    1.阻止VMware开机时的几个进程应用 禁用系统相关服务即可! 具体操作如下:开始运行中输入msconfig,然后点击服务!这时会出现很多服务选项.点击下面的隐藏所有microsoft服务,就只剩下 ...

  7. 007 The Inheritance In JAVA

    在JAVA中有一个特型叫继承(Inheritance),通过继承我们可以重复使用代码,令代码简洁,易于扩展.例如:有一个sharp的类,这个类实现了sharp的一些方法,现在我们要写一个circle的 ...

  8. 将Excel中数据导入数据库(二)

    在上篇文章中介绍到将Excel中数据导入到数据库中,但上篇文章例子只出现了nvachar类型,且数据量很小.今天碰到将Excel中数据导入数据库中的Excel有6419行,其中每行均有48个字段,有i ...

  9. 【考试】简单的sql语句

    )显示正好为5个字符的员工的姓名 HR@ORA11GR2>select last_name,first_name from employees ; )显示不带有"R"的员工的 ...

  10. 在java 中,数组与 List<T> 类型的相互转换

    在java中,数组与List<T> 之前进行互相转换,转换方法可总结为以下几种: 一. 将 数组转换成List<T> 1. 使用 Collections 的addAll 方法 ...