Giter Site home page Giter Site logo

image-examples's Introduction

Image Examples

Simple examples of how to convert images from one format to another -- raw rgb565 (rgb16), rgb24 (rgb888), png, jpeg, bmp, etc.

Please fork and contribute!

Usage

See README.md in scripts for mayn rgb, png, and jpeg examples

raw rgb565 to ppm:

# rgb565toppm <infile> <width> <height> <maxval> fb.ppm
# rgb565 has maxval of 255 per pixel because it is converted to rgb888
rgb565toppm fb.rgb565.bin 720 480 255 fb.ppm

raw rgb565 to bmp:

# rgb565toppm <infile> <width> <height> <bitdepth> fb.ppm
# Bug: only reliably works converting from a depth of 16 to 32
rgb565tobmp fb.rgb565.bin 720 480 32 fb.bmp

Dependecies

Bugs

bmptorgb565

bmptorgb565 only supports bitmaps with headers that meet the formal spec... so basically it doesn't work

Image size is (7204803) or 1036800 bytes Header is 54 bytes

Header of reference.24.bmp:

0000000 42 4d 36 d2 0f 00 00 00 00 00 36 00 00 00 28 00
0000010 00 00 d0 02 00 00 20 fe ff ff 01 00 18 00 00 00
0000020 00 00 00 00 00 00 13 0b 00 00 13 0b 00 00 00 00
0000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Note that the width is not written correctly by either of OSX Preview or OSX Paintbrush

fe ff ff ff is completely wrong for the height. 00 00 00 00 is obviously not the correct size.

Header read:

type: 4d42
total size: 15
offset: 2621440
width: 4263510016
width: 131071
bitcount(color depth): 0
size image (image size): 185794560
image size in bytes: 181440

 Red16: 0 
 Green16: 0 
 Blue16: 0 
 RGB2Bytes: 0 
Segmentation fault <-- Obvious sign that it doesn't work

References

Interesting examples:

# Multiple Images / RAW Video
ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 1024x768 -i movie.raw -f image2 -vcodec png image%d.png

# Stream / RAW Video
command-that-streams-to-stdout | ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s 1024x768 -i - -f image2 -vcodec png image%d.png

image-examples's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.