Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #3278
| Newsgroups | comp.sys.apple2.programmer |
|---|---|
| Date | 2017-02-18 10:48 -0800 |
| References | <mfjb1l$kam$1@speranza.aioe.org> <mjdkgg$ea1$1@speranza.aioe.org> |
| Message-ID | <ab918149-ed75-4ce2-8568-d9efc2eefa73@googlegroups.com> (permalink) |
| Subject | Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided |
| From | Chris Torrence <gorthmog@gmail.com> |
Resurrecting an old thread... For anyone looking to call b2d from Python...
First step was to build b2d on macOS (10.12.3) following nicola and mmphosis:
gcc -DMINGW -arch i386 -Wno-pointer-sign -Wno-comment -o ../b2d b2d.c
The next crucial step is to resize your input images to be the correct size for HGR/DHGR etc. If you don't have the correct size then b2d will complain about "wrong format!".
Here, my Python code is reading an image from a URL (works just as well from a .jpg or .png file), resizing to be 280x192 (since I want HGR), saving it to a BMP, then calling b2d. Then I read in the bytes and do something with them.
from PIL import Image
import subprocess
img = Image.open(requests.get(url, stream=True).raw)
img = img.resize((280,192))
img.save('temp.bmp')
subprocess.check_call(['./b2d', 'temp.bmp', 'hgr'])
f = open("TEMPC.BIN", "rb")
data = f.read(8192)
f.close()
Hopefully this will help anyone else who is doing something similar.
Cheers,
Chris
Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-02 07:00 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Nicola <nvitacolonna@gmail.com> - 2015-04-02 18:25 +0300
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-02 20:20 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-02 22:04 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Nicola <nvitacolonna@gmail.com> - 2015-04-03 09:18 +0300
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Nicola <nvitacolonna@gmail.com> - 2015-04-03 09:56 +0300
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Steve Nickolas <usotsuki@buric.co> - 2015-04-03 09:04 +0200
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Nicola <nvitacolonna@gmail.com> - 2015-04-03 14:57 +0300
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-03 10:09 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Nicola <nvitacolonna@gmail.com> - 2015-04-03 18:42 +0300
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-03 10:56 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-03 22:23 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Nicola <nvitacolonna@gmail.com> - 2015-04-04 11:26 +0300
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-04 06:45 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided mmphosis <mmphosis@macgui.com> - 2015-04-03 17:13 +0000
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-03 12:38 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Nicola <nvitacolonna@gmail.com> - 2015-04-03 20:52 +0300
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-04-03 13:11 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided mmphosis <mmphosis@macgui.com> - 2015-04-03 03:09 +0000
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2015-05-18 16:10 -0500
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Chris Torrence <gorthmog@gmail.com> - 2017-02-18 10:48 -0800
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Lifepillar <lifepillar@lifepillar.me> - 2017-02-18 21:53 +0100
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Lifepillar <lifepillar@lifepillar.me> - 2017-02-18 22:07 +0100
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2017-02-20 15:51 -0600
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided "Bill Buckels" <bbuckels@mts.net> - 2017-02-28 04:16 -0600
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided Presley Acuna <presleyacuna@gmail.com> - 2023-09-04 05:07 -0700
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modes including Mode320 and Mode3200 SHR now provided David Schmidt <schmidtd@my-deja.com> - 2023-09-05 08:40 -0400
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modesincluding Mode320 and Mode3200 SHR now provided mmphosis <mmphosis@macgui.com> - 2023-09-05 23:01 +0000
Re: Update: Bmp2DHR and A2FCBmp - All Apple II Graphics Modesincluding Mode320 and Mode3200 SHR now provided Oliver Schmidt <ol.sc@web.de> - 2023-09-06 07:59 +0000
csiph-web