Guides/Window Driver/Image

From J Wiki
Jump to navigation Jump to search

Image format

The following formats are supported by Qt

Format Description Qt's support
BMP Windows Bitmap Read/write
GIF Graphic Interchange Format (optional) Read
JPG Joint Photographic Experts Group Read/write
JPEG Joint Photographic Experts Group Read/write
PNG Portable Network Graphics Read/write
PBM Portable Bitmap Read
PGM Portable Graymap Read
PPM Portable Pixmap Read/write
TIFF Tagged Image File Format Read/write
XBM X11 Bitmap Read/write
XPM X11 Pixmap Read/write

jandroid only supports jpeg and png format.

Verbs for reading and writing image files

The following verbs are defined inside qt.ijs

getimg (monad) - reading file images from memory to argb matrix

y raw image data

rgb=: getimg fread jpath '~temp/plot.png'

readimg (monad) - reading file images to argb matrix

y image file name

rgb=: readimg jpath '~temp/plot.png'

putimg (dyad) - write image data to memory

x rgb matrix
y 'jpeg|png|ico|bmp' [ ; 'quality' ; '[0,100]|_1' ]

data=: rgb getimg 'jpeg'

writeimg (dyad) - write image data to file

x rgb matrix
y filename [ ; 'jpeg|png|ico|bmp' [ ; 'quality' ; [0,100]|_1 ]]

data=: rgb writeimg 'jpeg'

Locale

These verbs are defined inside the jqtide (or ja for jandorid) locale, not exported to the z locale. To use them, either

  • add jqtide to locale path
coinsert 'jqtide'
or
coinsert 'ja'
  • qualify verbs with locale name
readimg_jqtide_
writeimg_jqtide_
or
readimg_ja_
writeimg_ja_