PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
  Info   View files Documentation   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-12-30 (6 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: 141 This week: 11All time: 8,287 This week: 83Up
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
  Performance   Level  
Name: Bruno Henrique Ferreira ... <contact>
Classes: 4 packages by
Country: Brazil Brazil
Innovation award
Innovation award
Nominee: 3x

Winner: 1x

Details

?=============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  
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  /  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  /  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  /  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  /  public  /  js  
File Role Description
  Accessible without login Plain text file coloRequest.js Data Request and control of the change.

  Files folder image Files  /  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  /  public  /  css  
File Role Description
  Accessible without login Plain text file style.css Example Simple css style file.

 Version Control Unique User Downloads Download Rankings  
 76%
Total:141
This week:11
All time:8,287
This week:83Up