PHP Classes

PHP Image Compression Analysis: Compare an image with itself encoded as JPEG

Recommend this page to a friend!
  Info   View files Documentation   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 158 This week: 1All time: 8,990 This week: 560Up
Version License PHP version Categories
imageanalysis 1.0.1Custom (specified...5Algorithms, PHP 5, Graphics
Description 

Author

This package can compare an image with itself encoded as JPEG.

The main class takes the path of one image file and creates a new image in JPEG format using a given compression level.

The class can scans the original image and the newly JPEG encoded version and creates a third image that highlights the difference between the initial image and the recompressed version.

It also takes a scale parameter that defines the level of amplification of the differences between the two images.

Innovation Award
PHP Programming Innovation award nominee
June 2018
Number 2
JPEG is an algorithm for storing image data in files. It uses compression methods to reduce the size of the files that store the images.

The JPEG algorithm takes a percentage parameter that specifies the compression level that is applied to reduce the resulting file size at the expense of sacrificing the fidelity of the compressed image relatively to the original image.

This package can compare the original version of an image and another version after being compressed using the JPEG algorithm with a given compression level.

The result is an image that shows the differences between the original image and the compressed version, so you can verify the fidelity level that is lost.

Manuel Lemos
Picture of Ganesh Kandu
  Performance   Level  
Name: Ganesh Kandu <contact>
Classes: 4 packages by
Country: India India
Age: ???
All time rank: 3036191 in India India
Week rank: 109 Up9 in India India Up
Innovation award
Innovation award
Nominee: 2x

Documentation

Error Level Analysis

This tool compares the original image to a recompressed version. This can make manipulated regions stand out in various ways. For example they can be darker or brighter than similar regions which have not been manipulated.

JPEG Quality

This should match the original quality of the image that has been edited.

Error Scale

Makes the differences between the original and the recompressed image bigger

> best works with jpeg image

Requirement

PHP 5.3+ and GD extension installed

Get Started

Installation

This library is designed to be installed via Composer.

Add the dependency into your projects composer.json.

{
  "require": {
    "ganeshkandu/imageanalysis": "*"
  }
}

Download the composer.phar

curl -sS https://getcomposer.org/installer | php

Install the library.

php composer.phar install

or

> To add in in your dependencies

php composer.phar require ganeshkandu/imageanalysis

USAGE


<?php

include "vendor/autoload.php";

use ImageAnalysis\ImageAnalysis;

/*
	@desc This can make manipulated regions stand out in various ways.
		For example they can be darker or brighter than similar regions
		which have not been manipulated.
	@author ganesh kandu <kanduganesh@gmail.com>
	@param image location
	@param Quality
	@param Scale
	@return image resource
*/

$out = ImageAnalysis::ELA('sample.jpg',80,10);

header('Content-Type: image/jpeg');

imagejpeg($out);

imagedestroy($out);

inspired from photo forensics

Main Developers


  Files folder image Files  
File Role Description
Files folder imagesrc (2 files)
Files folder imagetests (1 file, 1 directory)
Accessible without login Plain text file .travis.yml Data travis
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE.txt Lic. License text
Accessible without login Plain text file phpunit.xml.dist Data phpunit
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file Image.php Class main file
  Plain text file ImageAnalysis.php Class ELA file

  Files folder image Files  /  tests  
File Role Description
Files folder imagefixtures (1 file)
  Plain text file ImageAnalysisTest.php Class test file

  Files folder image Files  /  tests  /  fixtures  
File Role Description
  Accessible without login Image file sample.jpg Icon sample image

 Version Control Unique User Downloads Download Rankings  
 100%
Total:158
This week:1
All time:8,990
This week:560Up
User Comments (1)
Thats a very great class ;-)
5 years ago (José Filipe Lopes Santos)
70%StarStarStarStar