I'd like to create a bitmap (black and white) from within LuaTeX (or pdfTeX) and rescale it afterwards. For example (a 4x4 bitmap) could be made by
\makebitmap{0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0}
I don't really care about the interface. More important for me is the overall approach.
I would like to use it in LuaTeX, thus img.stream
could be useful for me. But a PDFTeX approach with \pdf...
commands would be fine, too.
Important restrictions: I must not create any intermediate file and it must work offline.
To make things clear: I am only interested in how to generate a bitmap graphics (png, bmp, whatever) within pdf/LuaTeX.
Background: I've developed a qrcode encoding lua library and I'd like make a LuaLaTeX package for it. I see three possible approaches:
- Use pdf instructions (
0 0 10 10 re f
for example) - Use
\rule
commands to make the black parts - Create a bitmap "file" and scale it.
I still experiment about the best approach.
I have tried with pdf instructions (item 1 above), and the result is ugly in some pdf viewer applications:
The black boxes are divided by some small white lines in some zoom settings. I want to avoid them. That is why I want to create bitmaps instead of pdf instructions.
.bmp
(or.png
or ...): exactly what format do you require? – Joseph Wright♦ Dec 30 '12 at 12:48:)
– Khaled Hosny Jan 3 '13 at 15:41