carica/canvas-graphics

dev-master 2020-02-07 15:41 UTC

This package is auto-updated.

Last update: 2024-12-08 01:55:38 UTC


README

Implementing the JS Canvas API in PHP (around GD). Not fully featured but in a way that allows to port code from JS to PHP.

Some time ago I read that really interesting blog post about SVG placeholders.

In this repository I try to experiment with the different ideas from the article. I try to find out if it is possible to use them in a PHP application.

Experiments

Colors

Extracts some colors from an image. The implementation is forked from ColorThiefPHP. Unlike the original Black and White are allowed and the handling of the alpha transparency is different.

I treat alpha transparency as it would be with a white background.

Colors

Gradients

A loose adoption of Gradify. It extracts the four colors using the palette from the Colors experiment.

Gradients

Paths

Traces an bitmap and creates SVG paths. Based on ImageTracerJS.

ImageTracer

Primitive

This concept tries to reproduce the original image using primitive shapes (triangle, rect, ellipse). Very few shapes and a strong blur the result is good impression of the image, already. The result is impressive, but it is expensive (cpu, memory) to create.

Primitive