使用应用程序在线将 JSON 文件转换为 IMAGE 文件
- 上传 JSON 文件进行转换
- 等待几秒钟或更长时间,具体取决于 JSON 大小
- 留意上传状态栏
- 点击“转换”按钮
- JSON 将转换为 IMAGE 文档
- 下载转换后的IMAGE文件
通过 .NET 自动化 API 将 JSON 转换为 IMAGE
通过 C# .NET 将 JSON 转换为 IMAGE
// create a Workbook object | |
var workbook = new Workbook("input.json"); | |
// save resultant file in JPEG format | |
workbook.Save("output.jpeg", SaveFormat.Auto); | |
// load JPEG file | |
var image = Image.Load("output.jpeg"); | |
// supports DICOM, JPEG2000, APNG, PSD, DXF, WMF, EMZ, WMZ, TGA, and SVGZ file format | |
// save JPEG to PSD file format | |
image.Save("output.psd", new PsdOptions()); |
使用其他功能(如 通过 C# 设置布局并将 JSON 格式转换为 IMAGE, 将 JSON 格式解析为带水印的 IMAGE)将 JSON 保存为 IMAGE 的情况较少。
// create a Workbook object | |
var workbook = new Workbook(); | |
var worksheet = workbook.Worksheets[0]; | |
// read JSON data from file | |
string jsonInput = File.ReadAllText("input.json"); | |
// set JsonLayoutOptions to treat Arrays as Table | |
var options = new Aspose.Cells.Utility.JsonLayoutOptions(); | |
options.ArrayAsTable = true; | |
options.IgnoreNull = true; | |
options.IgnoreObjectTitle = true; | |
options.IgnoreArrayTitle = true; | |
// import JSON data to worksheet starting at cell A1 | |
Utility.JsonUtility.ImportData(jsonInput, worksheet.Cells, 0, 0, options); | |
// save resultant file in JPEG format | |
workbook.Save("output.jpeg", SaveFormat.Auto); | |
// load JPEG file | |
var image = Image.Load("output.jpeg"); | |
// supports DICOM, JPEG2000, APNG, PSD, DXF, WMF, EMZ, WMZ, TGA, and SVGZ file format | |
// save JPEG to PSD file format | |
image.Save("output.psd", new PsdOptions()); |
// create a Workbook object | |
var workbook = new Workbook("input.json"); | |
// save resultant file in JPEG format | |
workbook.Save("output.jpeg", SaveFormat.Auto); | |
// load an existing JPEG image | |
Image image = Image.Load("output.jpeg"); | |
// declare a String object with Watermark Text | |
string theString = "45 Degree Rotated Text"; | |
// create and initialize an instance of Graphics class and Initialize an object of SizeF to store image Size | |
Graphics graphics = new Graphics(image); | |
SizeF sz = graphics.Image.Size; | |
// create an instance of Font, initialize it with Font Face, Size and Style | |
Font font = new Font("Times New Roman", 20, FontStyle.Bold); | |
// create an instance of SolidBrush and set its various properties | |
SolidBrush brush = new SolidBrush(); | |
brush.Color = Color.Red; | |
brush.Opacity = 0; | |
// initialize an object of StringFormat class and set its various properties | |
StringFormat format = new StringFormat(); | |
format.Alignment = StringAlignment.Center; | |
format.FormatFlags = StringFormatFlags.MeasureTrailingSpaces; | |
// create an object of Matrix class for transformation | |
Matrix matrix = new Matrix(); | |
// first a translation then a rotation | |
matrix.Translate(sz.Width / 2, sz.Height / 2); | |
matrix.Rotate(-45.0f); | |
// set the Transformation through Matrix | |
graphics.Transform = matrix; | |
// draw the string on Image Save output to disk | |
graphics.DrawString(theString, font, brush, 0, 0, format); | |
// supports DICOM, JPEG2000, APNG, PSD, DXF, WMF, EMZ, WMZ, TGA, and SVGZ file format | |
// save JPEG to PSD file format | |
image.Save("output.psd", new PsdOptions()); |
使用 .NET 开发 JSON 文件转换应用程序
需要开发基于 .NET 的软件应用程序来轻松保存和导出 JSON 文件到 IMAGE 文档吗? 借助
Aspose.Total for .NET
,任何 .NET 开发人员都可以集成上述 API 代码来编写跨多种格式的转换应用程序,包括 Microsoft Word、Excel、Powerpoint、PDF、电子邮件文件、图像和其他格式。 强大的.NET 文档转换库,支持许多流行格式,包括 JSON 格式。 将文档导出为其他格式,程序员可以使用 Aspose.Total 的 .NET 子 API,包括
Aspose.Words for .NET
、
Aspose.Cells for .NET
、
Aspose.Slides for .NET
、
Aspose.PDF for .NET
、
Aspose.Imaging for .NET
等。
JSON .NET 转换库
有三种可选方法可以将 Aspose.Total for .NET 安装到您的系统上。 请选择一个符合您需求的方案并按照分步说明进行操作:
- 安装 NuGet Package 。参见 文档
- 使用包管理器控制台安装库,并在 Visual Studio IDE 中选择其子 API,如 Aspose.Wrods 、 Aspose.Cells 、 Aspose.PDF 等
- 使用 Windows Installer 手动安装库
正在将 JSON 保存至 IMAGE 应用要求
我们的产品是完全跨平台的,并支持遵循“.NET Standard 2.0”规范的所有主要.NET 实现:
- Microsoft .NET Framework,从最早的2.0版本开始,到最新的“.NET Framework 4.8”结束
- .NET Core,从最早的2.0开始,到最新的‘.NET 6’结束
- Mono >= 2.6.7
由于 .NET 代码不依赖于底层硬件或操作系统,而只依赖于虚拟机,因此您可以自由地为 Windows、macOS、Android、iOS 和 Linux 开发任何类型的软件。 只需确保您已安装相应版本的.NET Framework、.NET Core、Windows Azure、Mono 或 Xamarin。
我们建议使用 Microsoft Visual Studio、Xamarin 和 MonoDevelop IDE 来创建 C#、F#、VB.NET 应用程序。
常见问题解答
- 我可以在我的应用程序中使用上述.NET 代码吗?是的,欢迎您下载此代码。可以轻松开发专业解决方案,使用 .NET 将 JSON 导出并保存到 IMAGE 文件。 使用 Aspose JSON 到 IMAGE 转换 API 在 .NET 中开发高级、独立于平台的软件。
- 这个文档导出应用程序只在 Windows 上有效吗?您可以灵活地从任何设备启动将文档从 JSON 导出到 IMAGE,无论它运行的操作系统是什么,无论是 Windows、Linux、Mac OS 还是 Android。 所需的只是一个现代的网络浏览器和一个有效的互联网连接。
- 使用在线应用程序转换多个 JSON 文档是否安全?当然!通过我们的服务生成的输出文件将在 24 小时内安全自动地从我们的服务器中删除。 因此,在此期间之后,与这些文件相关的下载链接将不再起作用。
- 应该使用什么浏览器来使用App?您可以使用任何现代网络浏览器(如 Google Chrome、Firefox、Opera 或 Safari)进行在线 JSON 文档转换。
- 我如何导出多个 JSON 文件?首先上传一个或多个要转换的文件。您可以拖放 JSON 文件,也可以直接单击白色区域。 然后,单击“转换”按钮,我们的在线转换应用程序将快速处理上传的文件。
- 转换 JSON 文件需要多长时间?该转换应用程序运行迅速,可能需要几秒钟或更长时间,具体取决于文档大小上传并保存为所需格式。