Convert blob of image (png or bmp) into Image
import Http
type Msg
= GotImage (Result Http.Error (Maybe Image))
getImage : Cmd Msg
getImage =
Http.get
{ url = "/image.png"
, expect = Http.expectBytes GotImage Image.decode
}Portable Network Graphics (PNG) is a raster-graphics file-format that supports lossless data compression. PNG was developed as an improved, non-patented replacement for Graphics Interchange Format (GIF).
PNG supports palette-based images (with palettes of 24-bit RGB or 32-bit RGBA colors), grayscale images (with or without alpha channel for transparency), and full-color non-palette-based RGB images (with or without alpha channel).
The BMP file format, also known as bitmap image file or device independent bitmap (DIB) file format or simply a bitmap, is a raster graphics image file format used to store bitmap digital images, independently of the display device (such as a graphics adapter), especially on Microsoft Windows and OS/2 operating systems.
Note: Using BMP 32bit is discouraged due to lack of proper support across browsers, so image will be 24bit (no alpha channel)
The Graphics Interchange Format (GIF)
Palette based image with support of animation (not implemented), Transparency (totally transparent color - use 0x00)
Create base64-url that can be used directly as img source (img [ src <| toPngUrl myImage ])
Create base64-url that can be used directly as img source (img [ src <| toBmpUrl myImage ])
Create base64-url that can be used directly as img source (img [ src <| toGifUrl myImage ])
Create Image of List Int where each Pixel is Int as 0xRRGGBBAA
Create Image of List (List Int) where each Pixel is Int as 0xRRGGBBAA
Create Image of Array Int where each Pixel is Int as 0xRRGGBBAA
Create Image of Array (Array Pixel) where each Pixel is Int as 0xRRGGBBAA
Take Image of and converts it to List Pixel where each Pixel is Int as 0xRRGGBBAA
Take Image of and converts it to matrix List (List Pixel) where each Pixel is Int as 0xRRGGBBAA
Take Image of and converts it to Array Pixel where each Pixel is Int as 0xRRGGBBAA
Take Image of and converts it to matrix Array (Array Pixel) where each Pixel is Int as 0xRRGGBBAA
Get width and height of Image
Color encoded as 0xRRGGBBAA
Data Model representing Image data, that can be used to create image, or convert primitives to use image pixels as data