OrigamiSat-2 jpg creating on LINUX #32026年05月11日 18:53

jpg creating #1 の記事の画像8個の解説を全て手作業で行うのは大変なので、
Rubyを使ったプログラミングで半自動化してみた。test1.hex を生成する際の
rbファイルの中の繰り返し回数(0..0x38c)は、SatNOGSからダウンロードした
csvファイルの行数に適宜、合わせるとよい。なお、test2.hexを生成した後、
FFD9 を含む最終行は一般に短いので、そこだけ手作業で編集する必要がある。
最後の test3.hex は、横一行(FFD8...FFD9)のJPEG構造の形をしている。
https://www.ne.jp/asahi/hamradio/je9pel/cas5atst.htm

Sample satnogs.csv: total_lines 908(d)=38c(h)
Image No.44(h) on 8 May 2026 by JH4XSY

test0.sh  ... Shell script using Ruby to output ext044.rb
test1.hex ... Extract the right side including the frame number of each row.
test2.hex ... Extract the data body from each row, excluding the frame number.
              Edit last line in it ending with FFD9 manually.
test3.hex ... Concatenate each line in test2.hex into one single line.
              The result starts with FFD8 and ends with FFD9.
              Edit it according to ChatGPT when JPEG image is not generated.

[ext044.rb]
> for i in 0..0x38c
> printf("grep 020003%04X satnogs.csv | head -1 | cut -c 77- >> test1.hex\n", i)
> end

[on Terminal]
$ ruby ext044.rb > test0.sh
$ sh test0.sh
$ cut -c 5-388 test1.hex > test2.hex
> Edit last line in test2.hex ending with FFD9.
$ tr -d '\n' < test2.hex > test3.hex
> Edit test3.hex according to ChatGPT.
$ cat test3.hex | xxd -r -p > test3.jpg

コメント

コメントをどうぞ

※メールアドレスとURLの入力は必須ではありません。 入力されたメールアドレスは記事に反映されず、ブログの管理者のみが参照できます。

※なお、送られたコメントはブログの管理者が確認するまで公開されません。

※投稿には管理者が設定した質問に答える必要があります。

名前:
メールアドレス:
URL:
次の質問に答えてください:
Tropical fish?

コメント:

トラックバック