PHP Classes
elePHPant
Icontem

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    
Last Updated Ratings Unique User Downloads Download Rankings
2018-07-03 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 122 This week: 39All time: 8,840 This week: 27Up
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
  Performance   Level  
Name: Ganesh Kandu <contact>
Classes: 3 packages by
Country: India India
Innovation award
Innovation award
Nominee: 1x

Details

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:122
This week:39
All time:8,840
This week:27Up
User Comments (1)
Thats a very great class ;-)
1 month ago (José Filipe Lopes Santos)
70%StarStarStarStar