村木です。 At 16:23 00/12/05 +0900, you wrote: >まず rand を使わないで再現できるスクリプトを用意してください. >たとえば fx, fy, tx, ty, co をどこかに保存しておくとか. ご指摘ありがとうございます。 スクリプトを少し修正して、一度randで作ったデータを保存しました。 で、そのデータを4/3倍して、動かなくなるデータとしました。 以下にスクリプト、動くデータ、壊れるデータを貼りつけます。 300,400はファイル名をそのままサイズに使っていますので、 お手数ですが拡張子無しのファイル名にしてください。 ruby gdtest.rb 300 -> OK testout.png は見ることが出来る ruby gdtest.rb 400 -> NG testout.png は壊れている --- gdtest.rb ------------------------------------------------- #! c:\ruby\bin\ruby.exe require "GD" fname = ARGV.pop sz = fname.to_i open (fname) do |f| # キャンバスを作る image = GD::Image.new(sz, sz) # ペン色の定義 white = image.colorAllocate(255, 255, 255) black = image.colorAllocate( 0, 0, 0) red = image.colorAllocate(255, 0, 0) blue = image.colorAllocate( 0, 0, 255) green = image.colorAllocate( 0, 255, 0) color = [white, black, red, blue, green] while $_ = f.gets fx, fy, tx, ty, co = split(",") image.line(fx.to_i, fy.to_i, tx.to_i, ty.to_i, color[co.to_i]) end #for open("testout.png", "wb") do |oimg| image.png oimg end #oimg end #open size --- 300 ------------------------------------------------------- 110,295,211,116,3 249,298,10,32,2 191,250,73,83,1 248,193,272,254,3 267,26,194,281,2 216,253,40,96,4 36,188,2,295,4 104,149,242,204,4 116,242,126,38,2 261,245,232,64,2 279,249,269,188,2 12,87,119,54,1 246,280,33,245,1 209,269,255,17,3 73,183,247,232,1 239,251,99,188,1 159,135,79,110,1 13,277,59,232,4 180,53,47,245,2 181,109,250,39,3 15,58,161,245,3 --- 400 ------------------------------------------------------- 147,393,281,155,3 332,397,13,43,2 255,333,97,111,1 331,257,363,339,3 356,35,259,375,2 288,337,53,128,4 48,251,3,393,4 139,199,323,272,4 155,323,168,51,2 348,327,309,85,2 372,332,359,251,2 16,116,159,72,1 328,373,44,327,1 279,359,340,23,3 97,244,329,309,1 319,335,132,251,1 212,180,105,147,1 17,369,79,309,4 240,71,63,327,2 241,145,333,52,3 20,77,215,327,3 ---------------------------------------------------------------