Solution for "A Graphics Object cannot be Created from an Image that has an Indexed Pixel Format"


错误信息

Solution for "A Graphics Object cannot be Created from an Image that has an Indexed Pixel Format"

Solution for "A Graphics Object cannot be Created from an Image that has an Indexed Pixel Format"

排查问题

 名称类型
 img.PixelFormatFormat8bppIndexedSystem.Drawing.Imaging.PixelFormat

当您访问/编辑以下类型的图像时,我们将收到错误“无法从具有索引像素格式的图像创建图形对象”

  • PixelFormatUndefined
  • PixelFormatDontCare
  • PixelFormat1bppIndexed
  • PixelFormat4bppIndexed
  • PixelFormat8bppIndexed
  • PixelFormat16bppGrayScale
  • PixelFormat16bppARGB1555

解决方案

转换img为bitmap

C# 全选
Bitmap img = new Bitmap(new Bitmap( imag ));

Solution for "A Graphics Object cannot be Created from an Image that has an Indexed Pixel Format"

C# 全选
try
{
    // create Image Object using rear image byte[]
    Image imag = Image.FromStream(new MemoryStream(imageR));
    // Derive BitMap object using Image instance, so that you can avoid the issue
    //"a graphics object cannot be created from an image that has an indexed pixel format"
    Bitmap img = new Bitmap(new Bitmap( imag ));
}
catch (Exception ex)
{
    MessageBox.Show(ex.Message);
}
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
管理员
上一篇:VS2010到VS2022各个版本的密钥
下一篇:html版权符号怎么打出来
评论列表

发表评论

评论内容
昵称:
验证码:
验证码
关联文章

Solution for "A Graphics Object cannot be Created from an Image that has an Indexed Pixel Format"
Cannot resolve scoped service from root provider ASP.NET Core
EF生成迁移脚本报错:Entity type '' has a split mapping, but it doesn't map any non-primary key property to the main store object. Keep at least one non-primary key property mapped to a column on '.
web前端格式化缩进Razor代码,razor format
TS有两个对象,便利B对象的属性,如果A对象有这个属性,就把B的值更新到A对象。
C# Graphics给图片添加水印
.net Core Swagger报错 the same schemaid is already used for type swagger
C# Graphics画有填充和无填充的形状
SqlSugar Image字段BUG
TinyMCE
C#多线程下载图片 URL转Image
sql server系统表详细说明 之 sys.objects
sql server系统表详细说明 之 sys.system_objects
sql server系统表详细说明 之 sys.all_objects
git-for-windows.exe 国内镜像下载
Macros $(DevEnvDir), $(SolutionFileName), $(SolutionPath), $(SolutionDir), $(SolutionName), $(SolutionExt) are not defined during publish. Worked fine during build
不同页面之间通讯交互数据;明细页保存后刷新A页面数据
.NET Core中使用编码GB2312报错‘GB2312‘ is not a supported encoding name 解决方案
SAP_GUI_for_Windows_8.00_Comp 客户端安装
VUE使用sass提示在sass文件中提示Syntax Error : this.getOptions is not a function

热门标签
.NET Core .NET Reactor ag-grid AI发布 api安全 ASP.NET Core C#DLL加密 C#播放声音 C#代码混淆 C#代码加密 ChromeDriver Codex DateTime DBeaver devexpress devTool DLL混淆 edge.js EF EFCore Electron element-ui el-form el-table excel FastReport FileStream FolderBrowerDialog FolderSelectDialog form提交 git gridcontrol gridview input javascript json字符串 JS转换对象JSON jwt JWT授权 linq log Math MCP mitmproxy MVC MySQL Navicat netstat nginx node_modules NSwag Nuget Nuget镜像 number PowerShell pyinstaller python pythoncom python爬虫 python抓包 pywin32 redis Requests-html RestSharp Selenium sql SQL Server Swagger to-cms Visual Studio VSCode vue VueRouter vue路由 VUE页面通讯 Webpack Windows Windows服务 winform wmi xlrd yaml YESCMS YESWEB开发框架 白象 表单提交 播放声音 打开URL 代码混淆 弹窗提醒 端口占用 对象转换 分布式 公共字典 机器码 进程排查 静态资源 开发指南 路由参数 密钥 配置教程 配置文件 权限 人工智能 任务 任务调度 日期间隔 日志 日志记录 省市区 授权验证 数据库 四舍五入 文案 文件读取 文件夹选择 文件目录选择 问题排查 行政区域数据 页面通讯 中间件 CSharp 事务锁 工单系统 并发控制 重复提交 CMS Markdig Markdown markdown-it marked 技术选型 VS Code 开发工具 源代码管理 版本控制 Docker PostgreSQL 时区 部署排查 CMS架构 EF Core 主题系统 二次开发 插件系统 容器 运维命令 镜像清理 Linux NAS 远程挂载 飞牛 fnOS
联系我们
联系电话:15090125178(微信同号)
电子邮箱:garson_zhang@163.com
站长微信二维码
微信二维码