首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏全栈程序员必看

    NumPy 文件存取 tofile,fromfile, load,save

    一,tofile()和fromfile() tofile()将数组中的数据以二进制格式写进文件 tofile()输出的数据不保存数组形状和元素类型等信息 fromfile()函数读回数据时需要用户指定元素类型 此外如果指定了sep参数,则fromfile()和tofile()将以文本格式对数组进行输入输出。sep参数指定的是文本数据中数值的分隔符。

    1.8K30发布于 2021-04-07
  • 来自专栏跟着阿笨一起玩NET

    Image.FromFile 锁文件的解决办法

    用Image.FromFile加载图片会锁文件: Image image = Image.FromFile(fileName); 解决办法: private Image GetImage(string

    40110发布于 2018-09-18
  • 来自专栏林德熙的博客

    WinForms 使用 Image 的 FromFile 方法加载文件和使用 Bitmap 有什么不同

    本文来告诉大家使用 GDI+ 的 Image.FromFile 加载图片文件和使用创建 Bitmap 传入图片文件有什么不同 如使用下面代码加载图片 using var image = Image.FromFile(imageFile, true); using var bitmap = new Bitmap(image); 和使用下面代码加载图片 using var bitmap = new Bitmap(imageFile); 不同在于使用 Image.FromFile 加载图片文件,将会进入默认解码模式,拿到的 bitmap 的格式是 32 - 本文会经常更新,请阅读原文: https://blog.lindexi.com/post/WinForms-%E4%BD%BF%E7%94%A8-Image-%E7%9A%84-FromFile

    1.5K10发布于 2021-11-15
  • 来自专栏python3

    布隆过滤器的Python实现(标准、计

    >>> recovered_bf = bloompy.get_filter_fromfile('filename.suffix') # 或者使用过滤器类的类方法 'fromfile' 来进行过滤器的复原 对应的类只能恢复对应的过滤器 >>> recovered_bf = bloompy.BloomFilter.fromfile('filename.suffix') # 返回已经插入的元素个数 >>> False >>> 12 in cbf False >>> cbf.count 0 # 从文件中恢复过滤器 >>> recovered_cbf = bloompy.CountingBloomFilter.fromfile ('filename.suffix') 存储与恢复 参见标准布隆过滤器,可以通过两种方式来进行过滤器的存储与复原: 类方法'fromfile' 函数get_filter_fromfile() 如果你很清楚的知道当前文件中的过滤器是一个标准布隆过滤器 ,那么你可以使类方法类恢复这个过滤器: bloompy.BloomeFilter.fromfile('filename.suffix) 如果是个计数布隆过滤器,那么就是使用: bloompy.CountingBloomFilter.fromfile

    2.7K10发布于 2020-01-03
  • 来自专栏程序生涯

    PHP递归复制文件夹的类

    php /* * 文件夹复制类, */ class CopyFile { public $fromFile; public $toFile; /* * $fromFile 要复制谁 * $toFile 复制到那 */ function copyFile($fromFile, $toFile) { $this-> CreateFolder($toFile); $folder1 = opendir($fromFile); while ($f1 = readdir($folder1)) = "..") { $path2 = "{$fromFile}/{$f1}"; if (is_file($path2)) {

    2.6K20发布于 2020-08-14
  • 来自专栏醉程序

    Java NIO 系列学习 06 - Channel to Channel Transfers

    下面是一段示例代码: RandomAccessFile fromFile = new RandomAccessFile("fromFile.txt", "rw"); FileChannel fromChannel = fromFile.getChannel(); RandomAccessFile toFile = new RandomAccessFile("toFile.txt", "rw"); FileChannel 下面是一段示例代码: RandomAccessFile fromFile = new RandomAccessFile("fromFile.txt", "rw"); FileChannel fromChannel = fromFile.getChannel(); RandomAccessFile toFile = new RandomAccessFile("toFile.txt", "rw"); FileChannel

    86120发布于 2019-12-29
  • 来自专栏跟着阿笨一起玩NET

    FileStream大文件复制

    string toPath, int eachReadLength) 11 { 12 //将源文件 读取成文件流 13 FileStream fromFile - eachReadLength) 24 { 25 toCopyLength = fromFile.Read(buffer, 0 , eachReadLength); 26 fromFile.Flush(); 27 toFile.Write(buffer - copied); 35 toCopyLength = fromFile.Read(buffer, 0, left); 36 fromFile.Flush ]; 45 fromFile.Read(buffer, 0, buffer.Length); 46 fromFile.Flush(); 47

    2.3K20发布于 2018-09-19
  • 来自专栏架构师之旅

    【Java SE】Java NIO系列教程(五) 通道之间的数据传输

    下面是一个简单的例子: 01 RandomAccessFile fromFile = new RandomAccessFile("fromFile.txt", "rw"); 02 FileChannel fromChannel = fromFile.getChannel(); 03 04 RandomAccessFile toFile = new RandomAccessFile("toFile.txt 下面是一个简单的例子: 01 RandomAccessFile fromFile = new RandomAccessFile("fromFile.txt", "rw"); 02 FileChannel fromChannel = fromFile.getChannel(); 03 04 RandomAccessFile toFile = new RandomAccessFile("toFile.txt

    882100发布于 2018-01-30
  • 来自专栏sktj

    python 文件分割 脚本

    kilobytes * 1000 chunksize = int(1.4 * megabytes) # default: roughly a floppy def split(fromfile split.py [file-to-split target-dir [chunksize]]') else: if len(sys.argv) < 3: interactive = True fromfile ') else: interactive = False fromfile, todir = sys.argv[1:3] # args in cmdline if len(sys.argv) == 4: chunksize = int(sys.argv[3]) absfrom, absto = map(os.path.abspath, [fromfile, todir ]) print('Splitting', absfrom, 'to', absto, 'by', chunksize) try: parts = split(fromfile

    1.1K60编辑于 2022-05-13
  • 来自专栏机器视觉CV

    OpenCV 处理中文路径、绘制中文文字的烦恼,这里通通帮你解决!

    解决的方法如下:我们借助 np.fromfile 和 cv2.imdecode 来实现中文路径的读取 import cv2 import numpy as np image = cv2.imdecode (np.fromfile(file="F:\莫山山.jpg", dtype=np.uint8), cv2.IMREAD_COLOR) # print(image) cv2.imshow("image", 其中 np.fromfile 代表的含义是从文本或者二进制文件构造 array,参数:file 是文件名,参数 dtype 是数据类型,因为是图像,所以我们使用 np.uint8 格式其中 np.fromfile cv2.imdecode 的含义是从内存中的指定缓冲区读取图像,参数:buf 就是数据缓存了,即上面 np.fromfile 得到的内容,参数:flag 见下图,即读取什么样的图片 (彩色、灰度等) ? import cv2 import numpy as np path = "F:/莫山山.jpg" image = cv2.imdecode(np.fromfile(file=path, dtype=np.uint8

    10K31发布于 2020-07-23
  • 来自专栏python3

    Python 视频文件的分割和合并

    import sys,os; kilobytes = 1024; megabytes = kilobytes*1024; chunksize = int(10*megabytes); def split(fromfile : for fname in os.listdir(todir): os.remove(os.path.join(todir,fname)) partnum = 0 inputfile = open(fromfile = open(filename, "wb") fileobj.write(chunk) fileobj.close() return partnum if __name__=="__main__": fromfile abc.mp4" todir = "F:\\split_parts\\" #chunksize = int(5000000) absfrom,absto = map(os.path.abspath,[fromfile ,todir]) print('分割:',absfrom,'to',absto,'by',chunksize) try: parts = split(fromfile,todir,chunksize)

    1.8K10发布于 2020-01-10
  • 来自专栏数据挖掘

    python判断两个文件是否相同

    splitlines(True) b = open("diff3.txt", "r").read().splitlines(True) # difflib.context_diff(a, b[, fromfile ][, tofile][, fromfiledate][, tofiledate][, n][, lineterm]) # fromfile:a的文件名 # tofile:b的文件名 文件的修改时间 # n:变化那一行前后n行展示,默认n=3 # lineterm:打印出来的换行符,默认为\n diff = difflib.context_diff(a, b, fromfile ='fromfile.txt', tofile='tofile.txt', n=0, lineterm="\n") result = "".join(diff) print result

    2.4K50发布于 2019-07-02
  • 来自专栏写字母的代码哥

    总结java中文件拷贝剪切的5种方式-JAVA IO基础总结第五篇

    @Test void testCopyFile1() throws IOException { File fromFile = new File("D:\data\test\newFile.txt" toFile = new File("D:\data\test2\copyedFile.txt"); try(InputStream inStream = new FileInputStream(fromFile @Test void testCopyFile2() throws IOException { Path fromFile = Paths.get("D:\data\test\newFile.txt 也可以灵活的选择使用下面的选项 StandardCopyOption.REPLACE_EXISTING 来忽略文件已经存在的异常,如果存在就去覆盖掉它 //如果目标文件存在就替换它 Files.copy(fromFile , anotherDir.resolve(fromFile.getFileName()), StandardCopyOption.REPLACE_EXISTING); } resolve

    1.5K42发布于 2020-09-23
  • 来自专栏【Android开发基础】

    android intent打开各种格式文档方法

    android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile android.intent.category.DEFAULT"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Uri uri = Uri.fromFile uri1 = Uri.parse(param); intent.setDataAndType(uri1, "text/plain"); } else { Uri uri2 = Uri.fromFile

    1.3K20编辑于 2023-02-10
  • 来自专栏csdn

    基于Java深度学习库Deep Java Library 的一键抠图功能

    Paths.get("src/test/resources/anime-girl.jpg"); Image img = BufferedImageFactory.getInstance().fromFile Paths.get("src/test/resources/fullbody2.jpg"); Image img = OpenCVImageFactory.getInstance().fromFile imageFile = Paths.get("src/test/resources/full_body.jpg"); Image img = OpenCVImageFactory.getInstance().fromFile imageFile = Paths.get("src/test/resources/full_body.jpg"); Image img = OpenCVImageFactory.getInstance().fromFile imageFile = Paths.get("src/test/resources/beauty.jpg"); Image img = OpenCVImageFactory.getInstance().fromFile

    30510编辑于 2024-11-21
  • 来自专栏拭心的安卓进阶之路

    Android开发:使用Intent打开电话、短信、邮箱、本地文件等系统应用程序整理大全

    android.intent.category.DEFAULT");   intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);   Uri uri = Uri.fromFile android.intent.category.DEFAULT");   intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);   Uri uri = Uri.fromFile Uri.parse (param);   intent.setDataAndType (URI1, "text/plain");   }   else {   Uri uri = Uri.fromFile android.intent.category.DEFAULT");   intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);   Uri uri = Uri.fromFile android.intent.category.DEFAULT");   intent.addFlags (Intent.FLAG_ACTIVITY_NEW_TASK);   Uri uri = Uri.fromFile

    1.6K20编辑于 2022-11-30
  • 来自专栏悠扬前奏的博客

    Java NIO-5.通道之间的数据传输

    transferFrom FileChannel.transferFrom()方法可以将数据从源通道传输到FileChannel中,一个简单例子如下: RandomAccessFile fromFile /data/from-data.txt", "rw"); FileChannel fromChannel = fromFile.getChannel(); RandomAccessFile toFile transferTo() transferTo()方法将FileChannel中的数据传输到其他的通道中,例如: RandomAccessFile fromFile = new RandomAccessFile ("fromFile.txt", "rw"); FileChannel fromChannel = fromFile.getChannel(); RandomAccessFile toFile

    89320发布于 2019-05-30
  • 来自专栏Angular学习规划

    winform之图片上下张

    private void Form1_Load(object sender, EventArgs e) { pictureBox1.Image = Image.FromFile //pictureBox1.Image.Dispose(); } pictureBox1.Image = Image.FromFile { i = path.Length-1; } pictureBox1.Image = Image.FromFile

    1K20编辑于 2022-06-28
  • 来自专栏小小码农一个。

    Java 在PDF中添加表格

    在表格第2列填充图片并设置列宽 grid.getRows().get(1).getCells().get(1).getStyle().setBackgroundImage(PdfImage.fromFile scdx.png")); grid.getRows().get(2).getCells().get(1).getStyle().setBackgroundImage(PdfImage.fromFile xnjtdx.png")); grid.getRows().get(3).getCells().get(1).getStyle().setBackgroundImage(PdfImage.fromFile dzkjdx.png")); grid.getRows().get(4).getCells().get(1).getStyle().setBackgroundImage(PdfImage.fromFile

    7.7K20发布于 2020-06-08
  • C#生成缩略图

    height, string mode,string type) { System.Drawing.Image originalImage = System.Drawing.Image.FromFile Path_sy) { string addText = "测试水印"; System.Drawing.Image image = System.Drawing.Image.FromFile string Path_syp, string Path_sypf) { System.Drawing.Image image = System.Drawing.Image.FromFile string Path_syp, string Path_sypf) { System.Drawing.Image image = System.Drawing.Image.FromFile System.Drawing; using System.Drawing.Drawing2D System.Drawing.Image image = System.Drawing.Image.FromFile

    54900编辑于 2025-04-05
领券