File: examples/jpg2png.php

Recommend this page to a friend!
  Classes of Jose Luis Quintana  >  GImage  >  examples/jpg2png.php  >  Download  
File: examples/jpg2png.php
Role: Example script
Content type: text/plain
Description: Example script
Class: GImage
Create graphic images with a fluent interface
Author: By
Last change: fix doc comments
Date: 2 years ago
Size: 828 bytes


Class file image Download
 * This file is part of GImage.
 * (c) Josť Luis Quintana <>
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.

 * Convert JPEG image to PNG with opacity.
 * @author Josť Luis Quintana <>

namespace GImage\Examples;


__DIR__ . '/_config.php';
__DIR__ . '/../tests/bootstrap.php';

$image = new Image();
// Load a JPEG image
// Resize and crop in the middle (100px x 80px)
->centerCrop(100, 80)
// Change the format
// Set opacity to 50%
// Save the resource
->save(__DIR__ . '/jpg2png.png');

For more information send a message to info at phpclasses dot org.