Expand description
SQP (SQuishy Picture Format) is an image format. It can be used to store image data in lossless or lossy compressed form. It is designed to be relatively simple compared to other more standard formats.
This image format is mainly for experimentation and learning about compression. While it can be used, there are no guarantees about stability, breaking changes, or features.
If you’re looking for an image format to use, you might want to consider using a more standard one such as those supported by the image crate.
§Example
§Creating and writing an SQP
use sqp::{SquishyPicture, ColorFormat};
let width = 2;
let height = 2;
let bitmap = vec![
255, 255, 255, 255, 0, 255, 0, 128,
255, 255, 255, 255, 0, 255, 0, 128
];
// Create a 2×2 image in memory. Nothing is compressed or encoded
// at this point.
let sqp_image = SquishyPicture::from_raw_lossless(
width,
height,
ColorFormat::Rgba8,
bitmap
);
// Write it out to a file. This performs compression and encoding.
sqp_image.save("my_image.sqp").expect("Could not save the image");
§Reading an SQP from a file.
use std::fs::File;
use sqp::SquishyPicture;
// Load it directly with the `open` function...
let image = sqp::open("my_image.sqp").expect("Could not open file");
// ...or from something implementing Read.
let input_file = File::open("my_image.sqp").expect("Could not open image file");
let image2 = SquishyPicture::decode(&input_file);
Modules§
- header
- Structs and enums which are included in the header of SQP files.
- picture
- Functions and other utilities surrounding the
SquishyPicture
type.
Structs§
- Squishy
Picture - The basic Squishy Picture type for manipulation in-memory.
Enums§
- Color
Format - The format of bytes in the image.
- Compression
Type - The type of compression used in the image
Functions§
- open
- Open an SQP from a given path. Convenience method around
SquishyPicture::decode
. Returns aResult<SquishyPicture>
.