PHP Classes

PNG Hex Color Modifier: Replaces a color in a PNG image by another color

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 160 All time: 8,971 This week: 524Up
Version License PHP version Categories
hexpng 1.1Custom (specified...5PHP 5, Graphics
Description 

Author

This class can replaces a color in a PNG image by another color.

It takes a given color and replaces it in PNG image by another color.

The class saves back the image PNG file and returns the changed image as a data URL.

Innovation Award
PHP Programming Innovation award winner
August 2016
Winner


Prize: One big elePHPant Plush Mascott
Sometimes you need to generate variants of the same image to present it in different colors.

PHP provides a good set of functions that you can use to manipulate images in any way you need. However some kinds of image processing can be very slow to run as PHP scripts.

This class provides a solution to create variants of a PNG image with a different background color, just by reading the PNG file contents and replacing a few bytes in the image file data directly.

Manuel Lemos
Picture of Bruno Henrique Ferreira de Oliveira
  Performance   Level  
Name: Bruno Henrique Ferreira ... <contact>
Classes: 4 packages by
Country: Brazil Brazil
Age: 32
All time rank: 2921213 in Brazil Brazil
Week rank: 192 Up14 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Documentation

?=============PNG Hex Color Modifier=============

Introduction.

-Paint a png image by hex reflecting in the front.

-Overrides the Hex value of the main PNG image file and make it viewed for the web and S.O.

-The client-side changes are controlled by the javascript.

-Even when reloading the page, the color continues as the last modified because the image file was modified too.

Requirements.

-PHP 5;

Instalation.

-The test.png in the img directory is the PNG that will be modified.

-The main class is in the resources directory.

-The controller is the javascript and it is loaded by the home.html where are the radios buttons for the test.

-Bonus: JPG image HEX color modifier added (experimental stable release), download main image and set it in home.html.

To do.

-Add support for more colors.

License

-In the custom license file.


  Files folder image Files (13)  
File Role Description
Files folder imagedoc (3 files)
Files folder imageimg (2 files)
Files folder imagepublic (1 file, 2 directories)
Files folder imageresources (3 files)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (13)  /  doc  
File Role Description
  Accessible without login Plain text file DOC.md Doc. Image behavior note in portuguese
  Accessible without login Plain text file LICENSE.md Lic. Custom License file.
  Accessible without login Plain text file README.md Doc. Introduction, requirements, usage, to do.

  Files folder image Files (13)  /  img  
File Role Description
  Accessible without login Image file test.jpg Data My JPG image test for my bonus.
  Accessible without login Image file test.png Data Main PNG file that will be modified.

  Files folder image Files (13)  /  public  
File Role Description
Files folder imagejs (1 file)
Files folder imagecss (1 file)
  Accessible without login Plain text file home.html Data Client-side reflect.

  Files folder image Files (13)  /  public  /  js  
File Role Description
  Accessible without login Plain text file coloRequest.js Data Request and control of the change.

  Files folder image Files (13)  /  resources  
File Role Description
  Plain text file ImageHexModJPG.php Class Bonus, JPG Edition of Hex color modifier.
  Plain text file ImageHexModPNG.php Class PHP class file.
  Accessible without login Plain text file post.php Example Example script

  Files folder image Files (13)  /  public  /  css  
File Role Description
  Accessible without login Plain text file style.css Example Simple css style file.

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 76%
Total:160
This week:0
All time:8,971
This week:524Up