Difference between revisions of "Command/bitmapimage"
< Command
Jump to navigation
Jump to search
Line 31: | Line 31: | ||
</cd:assignments> | </cd:assignments> | ||
<cd:keywords delimiters="braces" ordinal="2"> | <cd:keywords delimiters="braces" ordinal="2"> | ||
− | <cd:keywordsdoc>For each pixel, the color code, in rgb mode for example: | + | <cd:keywordsdoc>For each pixel, the color code, in rgb mode for example: "FF0000" for a first red pixel, then "00FF00" for a second green pixel,... |
− | + | At the end you should get a lengthy string like "FF000000FF00..." | |
− | + | </cd:keywordsdoc> | |
− | |||
<cd:constant type="cd:number"></cd:constant> | <cd:constant type="cd:number"></cd:constant> | ||
</cd:keywords> | </cd:keywords> |
Revision as of 17:25, 8 May 2024
Contents
\bitmapimage
Summary
The command \bitmapimage is used to produce bitmap image giving color code for each pixel, from left ro right and top to bottom.
Settings
\bitmapimage[...=...,...]{...} | |
color | rgb cmyk gray |
width | dimension |
height | dimension |
x | number |
y | number |
{...} | number |
Option | Explanation | ||
---|---|---|---|
width |
| ||
height |
| ||
x |
| ||
y |
| ||
For each pixel, the color code, in rgb mode for example: "FF0000" for a first red pixel, then "00FF00" for a second green pixel,...
At the end you should get a lengthy string like "FF000000FF00..." |
Description
Examples
Example 1
\bitmapimage[x=2, y=2, width=4cm, height=4cm,color=rgb]{44000088000CC00000FF0000}
More complex
Since you're unlikely to define bitmap images by hand, you'll probably prefer to use lua :-)
\startluacode function document.TestBitmap(nx,ny) local r = { } for i=1,nx do for j=1,ny do r[#r+1] = string.format("%02x%02x%02x", math.floor(i/nx*255), math.floor(j/nx*255), 0) end end r = table.concat(r,"\r",1,nx*ny) context(r) end \stopluacode \bitmapimage[x=100,y=100,width=4cm, height=4cm,color=rgb]{\ctxlua{document.TestBitmap(100,100)}} \stoptext