All Projects → rahra → cairo_jpg

rahra / cairo_jpg

Licence: LGPL-3.0 license
Reading and writing JPEG files from/to Cairo surfaces.

Programming Languages

c
50402 projects - #5 most used programming language

Labels

Projects that are alternatives of or similar to cairo jpg

HEIF
Mac OS X: Convert any image to HEIF/HEIC format
Stars: ✭ 58 (+123.08%)
Mutual labels:  jpeg
tyf
Manipulate EXIF and IFD metadata.
Stars: ✭ 16 (-38.46%)
Mutual labels:  jpeg
conky-for-macOS
macOS port of the Light-weight system monitor for X.
Stars: ✭ 139 (+434.62%)
Mutual labels:  cairo
node-pdftocairo
📃 Node.js wrapper for pdftocairo - PDF to PNG/JPEG/TIFF/PDF/PS/EPS/SVG using cairo
Stars: ✭ 17 (-34.62%)
Mutual labels:  jpeg
gtk-rs-core
Rust bindings for GNOME libraries
Stars: ✭ 179 (+588.46%)
Mutual labels:  cairo
mplcairo
A (new) cairo backend for Matplotlib.
Stars: ✭ 87 (+234.62%)
Mutual labels:  cairo
video thumbnail
This plugin generates thumbnail from video file or URL. It returns image in memory or writes into a file. It offers rich options to control the image format, resolution and quality. Supports iOS and Android.
Stars: ✭ 159 (+511.54%)
Mutual labels:  jpeg
pixl
🚀 Lightweight image processing library in C++11
Stars: ✭ 31 (+19.23%)
Mutual labels:  jpeg
picojdec
Simple baseline JPEG decoder
Stars: ✭ 22 (-15.38%)
Mutual labels:  jpeg
cairo-by-example
Verbosely Documented, Minimal Starknet Contract Examples.
Stars: ✭ 63 (+142.31%)
Mutual labels:  cairo
go-view
Go-View is a project to build a rudementary GUI library for Go.
Stars: ✭ 19 (-26.92%)
Mutual labels:  cairo
node-poppler
Asynchronous node.js wrapper for the Poppler PDF rendering library
Stars: ✭ 97 (+273.08%)
Mutual labels:  cairo
gfxprim
Open-source modular 2D bitmap graphics library with emphasis on speed and correctness.
Stars: ✭ 32 (+23.08%)
Mutual labels:  jpeg
Generative-Art
A selection of generative art scripts written in Python
Stars: ✭ 284 (+992.31%)
Mutual labels:  cairo
StbSharp
C# port of the famous C framework
Stars: ✭ 62 (+138.46%)
Mutual labels:  jpeg
Guetzling
Guetzling is a simple script for macOS and Linux written in Bash, to automate (recursively finding files) the compression of jpegs using the Guetzli algorithm.
Stars: ✭ 20 (-23.08%)
Mutual labels:  jpeg
imagecodecs
Image transformation, compression, and decompression codecs. Forked from https://pypi.org/project/imagecodecs
Stars: ✭ 56 (+115.38%)
Mutual labels:  jpeg
jimp-compact
✏️ Lightweight version of Jimp -- An image processing library written entirely in JavaScript for Node.js
Stars: ✭ 55 (+111.54%)
Mutual labels:  jpeg
sail
The missing small and fast image decoding library for humans (not for machines) ⛵ https://sail.software
Stars: ✭ 206 (+692.31%)
Mutual labels:  jpeg
dom-to-image-more
Generates an image from a DOM node using HTML5 canvas
Stars: ✭ 231 (+788.46%)
Mutual labels:  jpeg

cairo_jpg

Introduction

This is an implementation of functions to import and export Cairo surfaces from and to JPEG files. It uses the same function prototypes as Cairo's PNG support.

Description

The implementation is done on top of the Cairo API. It does not access Cairo-internal functions. For compression and decompression a JPEG library is used. It compiles against libjpeg-turbo or the original libjpeg.

The following prototypes are implemented. Their functionality is equal to the PNG functions of Cairo with the advance that there are memory-buffer-based functions as well.

cairo_status_t cairo_image_surface_write_to_jpeg_mem(cairo_surface_t *sfc, unsigned char **data, size_t *len, int quality);
cairo_status_t cairo_image_surface_write_to_jpeg_stream(cairo_surface_t *sfc, cairo_write_func_t write_func, void *closure, int quality);
cairo_status_t cairo_image_surface_write_to_jpeg(cairo_surface_t *sfc, const char *filename, int quality);
cairo_surface_t *cairo_image_surface_create_from_jpeg_mem(void *data, size_t len);
cairo_surface_t *cairo_image_surface_create_from_jpeg_stream(cairo_read_func_t read_func, void *closure);
cairo_surface_t *cairo_image_surface_create_from_jpeg(const char *filename);

To compile this code you need to have installed the packages libcairo2-dev and libjpeg-dev. Compile with the following command to create an object file linkable to your code:

gcc -Wall -c `pkg-config cairo libjpeg --cflags --libs` cairo_jpg.c

Please have a look at the comments within the source files for further details. Don't hesitate to contact me at [email protected].

Testing

There is a main() function implemented which serves as demonstrational purpose and for testing. To compile with the main() function run the following statement:

gcc -Wall -o cairo_jpg -DCAIRO_JPEG_MAIN `pkg-config cairo libjpeg --cflags --libs` cairo_jpg.c

License

Cairo_JPG is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Cairo_JPG is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU General Public License along with Cairo_JPG. If not, see https://www.gnu.org/licenses/.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].